From fc8f414b67265092abd79558d46e5375dac88f5f Mon Sep 17 00:00:00 2001 From: Yousef Khadadeh Date: Mon, 11 May 2026 23:06:39 +0300 Subject: [PATCH] Changes related to text input on Android, general bug fixes, license change to GPLv3 --- CMakeLists.txt | 2 +- COPYING | 675 +++++++++++++++++ LICENSE | 7 - README.md | 4 +- android-project/app/proguard-rules.pro | 4 +- .../app/src/main/AndroidManifest.xml | 1 + .../erroratline0/infinipaint/InfiniPaint.java | 94 ++- .../infinipaint/InfiniPaintSurface.java | 20 +- .../InfiniPaintTextBoxEditable.java | 122 +++ .../InfiniPaintTextBoxInputConnection.java | 203 ++++- .../infinipaint/InfiniPaintTextBoxView.java | 54 +- .../com/erroratline0/infinipaint/IntPair.java | 14 - .../main/java/org/libsdl/app/SDLActivity.java | 12 +- assets/data/icons/RemixIcon/font-serif.svg | 1 + include/Helpers/CallbackManager.hpp | 18 + include/Helpers/ConvertVec.hpp | 18 + include/Helpers/FileDownloader.cpp | 18 + include/Helpers/FileDownloader.hpp | 18 + include/Helpers/FileDownloaderEmscripten.cpp | 18 + include/Helpers/FixedPoint.hpp | 18 + include/Helpers/Logger.cpp | 18 + include/Helpers/Logger.hpp | 18 + include/Helpers/MathExtras.hpp | 18 + include/Helpers/Networking/ByteStream.cpp | 18 + include/Helpers/Networking/ByteStream.hpp | 18 + include/Helpers/Networking/NetClient.cpp | 18 + include/Helpers/Networking/NetClient.hpp | 18 + include/Helpers/Networking/NetLibrary.cpp | 18 + include/Helpers/Networking/NetLibrary.hpp | 18 + include/Helpers/Networking/NetServer.cpp | 18 + include/Helpers/Networking/NetServer.hpp | 18 + .../DelayUpdateSerializedClassManager.cpp | 18 + .../DelayUpdateSerializedClassManager.hpp | 18 + .../NetObjGenericSerializedClass.hpp | 18 + .../Helpers/NetworkingObjects/NetObjID.cpp | 18 + .../Helpers/NetworkingObjects/NetObjID.hpp | 18 + .../NetworkingObjects/NetObjManager.cpp | 18 + .../NetworkingObjects/NetObjManager.hpp | 18 + .../NetObjManagerTypeList.cpp | 18 + .../NetObjManagerTypeList.hpp | 18 + .../NetworkingObjects/NetObjOrderedList.hpp | 18 + .../NetworkingObjects/NetObjOwnerPtr.decl.hpp | 18 + .../NetworkingObjects/NetObjOwnerPtr.hpp | 18 + .../NetworkingObjects/NetObjOwnerPtr.impl.hpp | 18 + .../NetObjTemporaryPtr.decl.hpp | 18 + .../NetworkingObjects/NetObjTemporaryPtr.hpp | 18 + .../NetObjTemporaryPtr.impl.hpp | 18 + .../NetworkingObjects/NetObjUnorderedSet.hpp | 18 + .../NetworkingObjects/NetObjWeakPtr.hpp | 18 + include/Helpers/Parallel.hpp | 18 + include/Helpers/Random.cpp | 18 + include/Helpers/Random.hpp | 18 + include/Helpers/SCollision.hpp | 18 + include/Helpers/StringHelpers.cpp | 18 + include/Helpers/StringHelpers.hpp | 18 + include/Helpers/VersionNumber.cpp | 18 + include/Helpers/VersionNumber.hpp | 18 + .../com.infinipaint.infinipaint.metainfo.xml | 4 +- macosinstall/Info.plist | 2 +- src/AndroidJNICalls.cpp | 332 ++++++-- src/AndroidJNICalls.hpp | 27 +- src/Bookmarks/BookmarkListItem.cpp | 18 + src/Bookmarks/BookmarkListItem.hpp | 18 + src/Bookmarks/BookmarkManager.cpp | 18 + src/Bookmarks/BookmarkManager.hpp | 18 + .../BrushStrokeCanvasComponent.cpp | 18 + .../BrushStrokeCanvasComponent.hpp | 18 + src/CanvasComponents/CanvasComponent.cpp | 18 + src/CanvasComponents/CanvasComponent.hpp | 18 + .../CanvasComponentAllocator.cpp | 18 + .../CanvasComponentAllocator.hpp | 18 + .../CanvasComponentContainer.cpp | 18 + .../CanvasComponentContainer.hpp | 18 + src/CanvasComponents/CanvasComponentType.hpp | 18 + .../EllipseCanvasComponent.cpp | 18 + .../EllipseCanvasComponent.hpp | 18 + src/CanvasComponents/ImageCanvasComponent.cpp | 18 + src/CanvasComponents/ImageCanvasComponent.hpp | 18 + .../RectangleCanvasComponent.cpp | 18 + .../RectangleCanvasComponent.hpp | 18 + .../TextBoxCanvasComponent.cpp | 18 + .../TextBoxCanvasComponent.hpp | 18 + src/CanvasTheme.cpp | 18 + src/CanvasTheme.hpp | 18 + src/ClientData.cpp | 18 + src/ClientData.hpp | 18 + src/CommandList.hpp | 18 + src/CoordSpaceHelper.cpp | 18 + src/CoordSpaceHelper.hpp | 18 + src/CoordSpaceHelperTransform.cpp | 18 + src/CoordSpaceHelperTransform.hpp | 18 + src/CustomEvents.cpp | 26 + src/CustomEvents.hpp | 37 + src/DrawCamera.cpp | 18 + src/DrawCamera.hpp | 18 + src/DrawCollision.cpp | 18 + src/DrawCollision.hpp | 18 + src/DrawData.cpp | 18 + src/DrawData.hpp | 18 + src/DrawingProgram/DrawingProgram.cpp | 42 ++ src/DrawingProgram/DrawingProgram.hpp | 24 + src/DrawingProgram/DrawingProgramCache.cpp | 18 + src/DrawingProgram/DrawingProgramCache.hpp | 18 + .../DrawingProgramSelection.cpp | 18 + .../DrawingProgramSelection.hpp | 18 + .../Layers/DrawingProgramLayer.cpp | 18 + .../Layers/DrawingProgramLayer.hpp | 18 + .../Layers/DrawingProgramLayerFolder.cpp | 18 + .../Layers/DrawingProgramLayerFolder.hpp | 18 + .../Layers/DrawingProgramLayerListItem.cpp | 18 + .../Layers/DrawingProgramLayerListItem.hpp | 18 + .../Layers/DrawingProgramLayerManager.cpp | 18 + .../Layers/DrawingProgramLayerManager.hpp | 18 + .../Layers/DrawingProgramLayerManagerGUI.cpp | 18 + .../Layers/DrawingProgramLayerManagerGUI.hpp | 18 + .../Layers/SerializedBlendMode.cpp | 18 + .../Layers/SerializedBlendMode.hpp | 18 + src/DrawingProgram/ToolConfiguration.cpp | 18 + src/DrawingProgram/ToolConfiguration.hpp | 18 + src/DrawingProgram/Tools/BrushTool.cpp | 18 + src/DrawingProgram/Tools/BrushTool.hpp | 18 + .../Tools/DrawingProgramToolBase.cpp | 22 + .../Tools/DrawingProgramToolBase.hpp | 22 + src/DrawingProgram/Tools/EditTool.cpp | 50 +- src/DrawingProgram/Tools/EditTool.hpp | 22 + .../Tools/EditTools/BrushEditTool.cpp | 41 + .../Tools/EditTools/BrushEditTool.hpp | 20 + .../EditTools/DrawingProgramEditToolBase.cpp | 22 + .../EditTools/DrawingProgramEditToolBase.hpp | 24 + .../Tools/EditTools/EllipseDrawEditTool.cpp | 61 ++ .../Tools/EditTools/EllipseDrawEditTool.hpp | 20 + .../Tools/EditTools/ImageEditTool.cpp | 34 + .../Tools/EditTools/ImageEditTool.hpp | 19 + .../Tools/EditTools/RectDrawEditTool.cpp | 62 ++ .../Tools/EditTools/RectDrawEditTool.hpp | 20 + .../Tools/EditTools/TextBoxEditTool.cpp | 415 +++++++++- .../Tools/EditTools/TextBoxEditTool.hpp | 43 +- src/DrawingProgram/Tools/EllipseDrawTool.cpp | 18 + src/DrawingProgram/Tools/EllipseDrawTool.hpp | 18 + src/DrawingProgram/Tools/EraserTool.cpp | 18 + src/DrawingProgram/Tools/EraserTool.hpp | 18 + src/DrawingProgram/Tools/EyeDropperTool.cpp | 18 + src/DrawingProgram/Tools/EyeDropperTool.hpp | 18 + src/DrawingProgram/Tools/GridModifyTool.cpp | 18 + src/DrawingProgram/Tools/GridModifyTool.hpp | 18 + src/DrawingProgram/Tools/LassoSelectTool.cpp | 18 + src/DrawingProgram/Tools/LassoSelectTool.hpp | 18 + src/DrawingProgram/Tools/LineDrawTool.cpp | 18 + src/DrawingProgram/Tools/LineDrawTool.hpp | 18 + src/DrawingProgram/Tools/PanCanvasTool.cpp | 18 + src/DrawingProgram/Tools/PanCanvasTool.hpp | 18 + src/DrawingProgram/Tools/RectDrawTool.cpp | 18 + src/DrawingProgram/Tools/RectDrawTool.hpp | 18 + src/DrawingProgram/Tools/RectSelectTool.cpp | 18 + src/DrawingProgram/Tools/RectSelectTool.hpp | 18 + src/DrawingProgram/Tools/ScreenshotTool.cpp | 18 + src/DrawingProgram/Tools/ScreenshotTool.hpp | 18 + src/DrawingProgram/Tools/TextBoxTool.cpp | 20 + src/DrawingProgram/Tools/TextBoxTool.hpp | 18 + src/DrawingProgram/Tools/ZoomCanvasTool.cpp | 18 + src/DrawingProgram/Tools/ZoomCanvasTool.hpp | 18 + src/FileHelpers.cpp | 18 + src/FileHelpers.hpp | 18 + src/FontData.cpp | 18 + src/FontData.hpp | 18 + src/GUIHolder.cpp | 22 + src/GUIHolder.hpp | 19 + src/GUIStuff/ClayImplement.cpp | 18 + src/GUIStuff/ElementHelpers/ButtonHelpers.cpp | 18 + src/GUIStuff/ElementHelpers/ButtonHelpers.hpp | 18 + .../ElementHelpers/CheckBoxHelpers.cpp | 18 + .../ElementHelpers/CheckBoxHelpers.hpp | 18 + .../ElementHelpers/ColorPickerHelpers.hpp | 18 + .../ColorPickerItemsHelpers.hpp | 18 + .../ElementHelpers/DropdownHelpers.hpp | 53 ++ src/GUIStuff/ElementHelpers/LayoutHelpers.cpp | 145 ++++ src/GUIStuff/ElementHelpers/LayoutHelpers.hpp | 29 + .../ElementHelpers/NumberSliderHelpers.hpp | 18 + src/GUIStuff/ElementHelpers/PopupHelpers.cpp | 18 + src/GUIStuff/ElementHelpers/PopupHelpers.hpp | 18 + .../ElementHelpers/RadioButtonHelpers.cpp | 18 + .../ElementHelpers/RadioButtonHelpers.hpp | 18 + .../ElementHelpers/TextBoxHelpers.cpp | 18 + .../ElementHelpers/TextBoxHelpers.hpp | 18 + .../ElementHelpers/TextLabelHelpers.cpp | 18 + .../ElementHelpers/TextLabelHelpers.hpp | 18 + src/GUIStuff/Elements/AlphaSlider.cpp | 18 + src/GUIStuff/Elements/AlphaSlider.hpp | 18 + src/GUIStuff/Elements/CheckBox.cpp | 18 + src/GUIStuff/Elements/CheckBox.hpp | 18 + src/GUIStuff/Elements/ColorPicker.decl.hpp | 18 + src/GUIStuff/Elements/ColorPicker.hpp | 18 + src/GUIStuff/Elements/ColorPicker.impl.hpp | 18 + .../Elements/ColorPickerButton.decl.hpp | 18 + src/GUIStuff/Elements/ColorPickerButton.hpp | 18 + .../Elements/ColorPickerButton.impl.hpp | 18 + src/GUIStuff/Elements/ColorPickerShaders.cpp | 18 + .../Elements/ColorRectangleDisplay.cpp | 18 + .../Elements/ColorRectangleDisplay.hpp | 18 + src/GUIStuff/Elements/DropDown.hpp | 156 ++-- src/GUIStuff/Elements/Element.cpp | 19 + src/GUIStuff/Elements/Element.hpp | 19 + src/GUIStuff/Elements/FontPicker.cpp | 41 +- src/GUIStuff/Elements/FontPicker.hpp | 19 + src/GUIStuff/Elements/GUIStuffHelpers.cpp | 18 + src/GUIStuff/Elements/GUIStuffHelpers.hpp | 18 + src/GUIStuff/Elements/GridScrollArea.cpp | 18 + src/GUIStuff/Elements/GridScrollArea.hpp | 18 + src/GUIStuff/Elements/HueVerticalSlider.cpp | 18 + src/GUIStuff/Elements/HueVerticalSlider.hpp | 18 + src/GUIStuff/Elements/ImageDisplay.cpp | 18 + src/GUIStuff/Elements/ImageDisplay.hpp | 18 + src/GUIStuff/Elements/LayoutElement.cpp | 18 + src/GUIStuff/Elements/LayoutElement.hpp | 18 + .../Elements/ManyElementScrollArea.cpp | 18 + .../Elements/ManyElementScrollArea.hpp | 18 + src/GUIStuff/Elements/MovableTabList.cpp | 18 + src/GUIStuff/Elements/MovableTabList.hpp | 18 + src/GUIStuff/Elements/MutableTextLabel.cpp | 18 + src/GUIStuff/Elements/MutableTextLabel.hpp | 18 + src/GUIStuff/Elements/NumberSlider.hpp | 18 + src/GUIStuff/Elements/PaintCircleMenu.cpp | 18 + src/GUIStuff/Elements/PaintCircleMenu.hpp | 18 + .../Elements/PositionAdjustingPopupMenu.cpp | 18 + .../Elements/PositionAdjustingPopupMenu.hpp | 18 + src/GUIStuff/Elements/RadioButton.cpp | 18 + src/GUIStuff/Elements/RadioButton.hpp | 18 + src/GUIStuff/Elements/RotateWheel.cpp | 18 + src/GUIStuff/Elements/RotateWheel.hpp | 18 + src/GUIStuff/Elements/SVGIcon.cpp | 18 + src/GUIStuff/Elements/SVGIcon.hpp | 18 + .../Elements/SaturationValueSquare.cpp | 18 + .../Elements/SaturationValueSquare.hpp | 18 + src/GUIStuff/Elements/ScrollArea.cpp | 18 + src/GUIStuff/Elements/ScrollArea.hpp | 18 + src/GUIStuff/Elements/SelectableButton.cpp | 18 + src/GUIStuff/Elements/SelectableButton.hpp | 18 + src/GUIStuff/Elements/TextBox.decl.hpp | 21 + src/GUIStuff/Elements/TextBox.hpp | 18 + src/GUIStuff/Elements/TextBox.impl.hpp | 81 +- src/GUIStuff/Elements/TextParagraph.cpp | 18 + src/GUIStuff/Elements/TextParagraph.hpp | 18 + src/GUIStuff/Elements/TreeListing.cpp | 18 + src/GUIStuff/Elements/TreeListing.hpp | 18 + src/GUIStuff/GUIFloatAnimation.cpp | 18 + src/GUIStuff/GUIFloatAnimation.hpp | 18 + src/GUIStuff/GUIManager.cpp | 23 + src/GUIStuff/GUIManager.hpp | 19 + src/GUIStuff/GUIManagerID.cpp | 18 + src/GUIStuff/GUIManagerID.hpp | 18 + src/GlobalConfig.cpp | 710 +++++++++++++++++- src/GlobalConfig.hpp | 18 + src/GridManager.cpp | 18 + src/GridManager.hpp | 18 + src/InputManager.cpp | 34 +- src/InputManager.hpp | 34 +- src/MainProgram.cpp | 24 + src/MainProgram.hpp | 19 + src/ResourceDisplay/FileResourceDisplay.cpp | 18 + src/ResourceDisplay/FileResourceDisplay.hpp | 18 + src/ResourceDisplay/ImageResourceDisplay.cpp | 18 + src/ResourceDisplay/ImageResourceDisplay.hpp | 18 + src/ResourceDisplay/ResourceDisplay.cpp | 18 + src/ResourceDisplay/ResourceDisplay.hpp | 18 + src/ResourceDisplay/SvgResourceDisplay.cpp | 18 + src/ResourceDisplay/SvgResourceDisplay.hpp | 18 + src/ResourceManager.cpp | 18 + src/ResourceManager.hpp | 18 + src/RichText/ParagraphStyleData.cpp | 18 + src/RichText/ParagraphStyleData.hpp | 18 + src/RichText/TextBox.cpp | 83 +- src/RichText/TextBox.hpp | 26 +- src/RichText/TextStyleModifier.cpp | 18 + src/RichText/TextStyleModifier.hpp | 18 + src/RichTextUserInput.cpp | 91 ++- src/RichTextUserInput.hpp | 29 +- src/ScaleUpCanvas.cpp | 18 + src/ScaleUpCanvas.hpp | 18 + src/Screens/DesktopDrawingProgramScreen.cpp | 18 + src/Screens/DesktopDrawingProgramScreen.hpp | 18 + src/Screens/DrawingProgramScreen.cpp | 22 + src/Screens/DrawingProgramScreen.hpp | 19 + src/Screens/FileSelectScreen.cpp | 18 + src/Screens/FileSelectScreen.hpp | 18 + src/Screens/PhoneDrawingProgramScreen.cpp | 299 +++++--- src/Screens/PhoneDrawingProgramScreen.hpp | 65 +- src/Screens/Screen.cpp | 19 + src/Screens/Screen.hpp | 19 + src/SharedTypes.hpp | 18 + src/SwitchCWD.cpp | 18 + src/SwitchCWD.hpp | 18 + src/TimePoint.cpp | 18 + src/TimePoint.hpp | 18 + src/Toolbar.cpp | 20 + src/Toolbar.hpp | 36 +- src/UndoManager.cpp | 18 + src/UndoManager.hpp | 18 + src/VersionConstants.cpp | 18 + src/VersionConstants.hpp | 18 + src/World.cpp | 23 + src/World.hpp | 19 + src/WorldGrid.cpp | 18 + src/WorldGrid.hpp | 18 + src/WorldScreenshot.cpp | 18 + src/WorldScreenshot.hpp | 18 + src/WorldUndoManager.cpp | 18 + src/WorldUndoManager.hpp | 18 + src/main.cpp | 36 +- 308 files changed, 8707 insertions(+), 440 deletions(-) create mode 100644 COPYING delete mode 100755 LICENSE create mode 100644 android-project/app/src/main/java/com/erroratline0/infinipaint/InfiniPaintTextBoxEditable.java delete mode 100644 android-project/app/src/main/java/com/erroratline0/infinipaint/IntPair.java create mode 100644 assets/data/icons/RemixIcon/font-serif.svg create mode 100644 src/GUIStuff/ElementHelpers/DropdownHelpers.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 954fc8a..0eb8b14 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -451,7 +451,7 @@ if(APPLE OR WIN32) set(CPACK_PACKAGE_VERSION_PATCH "1") set(CPACK_PACKAGE_VENDOR "ErrorAtLine0") set(CPACK_PACKAGE_CONTACT "erroratline0@gmail.com") - set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE") + set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING") endif() if(APPLE) diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..53d1f3d --- /dev/null +++ b/COPYING @@ -0,0 +1,675 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/LICENSE b/LICENSE deleted file mode 100755 index 32be175..0000000 --- a/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ -Copyright (c) 2026 Yousef Khadadeh - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 85b147b..6456e5c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ ⚒️ Build Manual

- MIT License + License: GPL v3 Release X (Twitter) follow Github Stars @@ -75,4 +75,4 @@ This app was inspired by [Lorien](https://github.com/mbrlabs/Lorien), another gr ## Contribution -Currently, I won't be accepting most pull requests. The program is at a stage where large parts of the code are constantly being rewritten, so unless it's something small and doesn't interfere with code I'm currently working on, I probably won't be merging it. Any issue reports (bug reports, feature requests, etc.) are welcome though! +Currently, I won't be accepting pull requests. The program is at a stage where large parts of the code are constantly being rewritten. Any issue reports (bug reports, feature requests, etc.) are welcome though! diff --git a/android-project/app/proguard-rules.pro b/android-project/app/proguard-rules.pro index bcd9ebc..3156ca7 100644 --- a/android-project/app/proguard-rules.pro +++ b/android-project/app/proguard-rules.pro @@ -17,7 +17,9 @@ #} -keep,includedescriptorclasses,allowoptimization class com.erroratline0.infinipaint.InfiniPaint { - void startTextInput(int); + void startTextInput(long, java.lang.String, int, int, int); + void updateCursorPos(int, int); + void updateTextboxAndCursorPos(java.lang.String, int, int); } -keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLActivity { diff --git a/android-project/app/src/main/AndroidManifest.xml b/android-project/app/src/main/AndroidManifest.xml index c8db854..b8111a8 100644 --- a/android-project/app/src/main/AndroidManifest.xml +++ b/android-project/app/src/main/AndroidManifest.xml @@ -79,6 +79,7 @@ . + */ + package com.erroratline0.infinipaint; import android.content.Context; @@ -16,10 +34,6 @@ import org.libsdl.app.SDLActivity; import org.libsdl.app.SDLDummyEdit; import org.libsdl.app.SDLSurface; -/** - * A sample wrapper class that just calls SDLActivity - */ - public class InfiniPaint extends SDLActivity { protected void onCreate(Bundle savedInstanceState) { @@ -40,7 +54,7 @@ public class InfiniPaint extends SDLActivity { } static class StartInfiniPaintTextInputTask implements Runnable { - public StartInfiniPaintTextInputTask(int textboxID, String str, int selectionBegin, int selectionEnd, int inputType) { + public StartInfiniPaintTextInputTask(long textboxID, String str, int selectionBegin, int selectionEnd, int inputType) { mTextBoxID = textboxID; mStr = str; mSelectionBegin = selectionBegin; @@ -48,7 +62,7 @@ public class InfiniPaint extends SDLActivity { mInputType = inputType; } - int mTextBoxID; + long mTextBoxID; String mStr; int mSelectionBegin; int mSelectionEnd; @@ -57,29 +71,75 @@ public class InfiniPaint extends SDLActivity { @Override public void run() { RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(1, 1); + //params.leftMargin = 1; + //params.topMargin = 1; - if (mTextEdit == null) { - mTextEdit = new InfiniPaintTextBoxView(getContext()); - mLayout.addView(mTextEdit, params); + if (mTextEdit2 == null) { + mTextEdit2 = new InfiniPaintTextBoxView(getContext()); + mLayout.addView(mTextEdit2, params); } else { - mTextEdit.setLayoutParams(params); + mTextEdit2.setLayoutParams(params); } - mTextEdit.setInitialData(mTextBoxID, mStr, mSelectionBegin, mSelectionEnd, mInputType); - mTextEdit.setVisibility(View.VISIBLE); - mTextEdit.requestFocus(); + mTextEdit2.setInitialData(mTextBoxID, mStr, mSelectionBegin, mSelectionEnd, mInputType); + mTextEdit2.setVisibility(View.VISIBLE); + mTextEdit2.requestFocus(); InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); - imm.showSoftInput(mTextEdit, 0); + imm.showSoftInput(mTextEdit2, 0); if (imm.isAcceptingText()) onNativeScreenKeyboardShown(); } } - static public void startTextInput(int textboxID, String str, int selectionBegin, int selectionEnd, int inputType) { - mSingleton.commandHandler.post(new StartInfiniPaintTextInputTask(textboxID, str, selectionBegin, selectionEnd, inputType)); + static class InfiniPaintUpdateCursorPosTask implements Runnable { + public InfiniPaintUpdateCursorPosTask(int selectionBegin, int selectionEnd) { + mSelectionBegin = selectionBegin; + mSelectionEnd = selectionEnd; + } + + int mSelectionBegin; + int mSelectionEnd; + + @Override + public void run() { + if (mTextEdit2 != null) { + InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); + mTextEdit2.ic.updateSelection(mSelectionBegin, mSelectionEnd); + imm.updateSelection(mTextEdit2, mSelectionBegin, mSelectionEnd, -1, -1); + } + } } - static InfiniPaintTextBoxView mTextEdit; + static class InfiniPaintUpdateTextboxAndCursorPosTask implements Runnable { + public InfiniPaintUpdateTextboxAndCursorPosTask(String str, int selectionBegin, int selectionEnd) { + mStr = str; + mSelectionBegin = selectionBegin; + mSelectionEnd = selectionEnd; + } + + String mStr; + int mSelectionBegin; + int mSelectionEnd; + + @Override + public void run() { + if (mTextEdit2 != null) { + InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); + mTextEdit2.ic.clearAndSetNewTextAndSelection(mStr, mSelectionBegin, mSelectionEnd); + imm.updateSelection(mTextEdit2, mSelectionBegin, mSelectionEnd, -1, -1); + } + } + } + + static public void startTextInput(long textboxID, String str, int selectionBegin, int selectionEnd, int inputType) { + mSingleton.commandHandler.post(new StartInfiniPaintTextInputTask(textboxID, str, selectionBegin, selectionEnd, inputType)); + } + static public void updateCursorPos(int selectionBegin, int selectionEnd) { + mSingleton.commandHandler.post(new InfiniPaintUpdateCursorPosTask(selectionBegin, selectionEnd)); + } + static public void updateTextboxAndCursorPos(String str, int selectionBegin, int selectionEnd) { + mSingleton.commandHandler.post(new InfiniPaintUpdateTextboxAndCursorPosTask(str, selectionBegin, selectionEnd)); + } } diff --git a/android-project/app/src/main/java/com/erroratline0/infinipaint/InfiniPaintSurface.java b/android-project/app/src/main/java/com/erroratline0/infinipaint/InfiniPaintSurface.java index da23356..cd1df22 100644 --- a/android-project/app/src/main/java/com/erroratline0/infinipaint/InfiniPaintSurface.java +++ b/android-project/app/src/main/java/com/erroratline0/infinipaint/InfiniPaintSurface.java @@ -1,8 +1,27 @@ +/* + * 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 . + */ + package com.erroratline0.infinipaint; import android.content.Context; import android.graphics.Insets; import android.os.Build; +import android.util.Log; import android.view.View; import android.view.WindowInsets; @@ -34,7 +53,6 @@ public class InfiniPaintSurface extends SDLSurface { WindowInsets.Type.ime()); nativeInfiniPaintUpdateIMESafeArea(imeInsets.top, imeInsets.bottom, imeInsets.left, imeInsets.right); - SDLActivity.onNativeInsetsChanged(combined.left, combined.right, combined.top, combined.bottom); if (insets.isVisible(WindowInsets.Type.ime())) { diff --git a/android-project/app/src/main/java/com/erroratline0/infinipaint/InfiniPaintTextBoxEditable.java b/android-project/app/src/main/java/com/erroratline0/infinipaint/InfiniPaintTextBoxEditable.java new file mode 100644 index 0000000..cb81cfc --- /dev/null +++ b/android-project/app/src/main/java/com/erroratline0/infinipaint/InfiniPaintTextBoxEditable.java @@ -0,0 +1,122 @@ +/* + * 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 . + */ + +package com.erroratline0.infinipaint; + +import android.os.Build; +import android.text.Editable; +import android.text.InputFilter; +import android.text.SpannableStringBuilder; +import android.widget.EditText; + +import java.util.stream.IntStream; + +public class InfiniPaintTextBoxEditable extends SpannableStringBuilder { + public static native void nativeReplace(long mTextBoxID, int st, int en, String str); + public static native String nativeGetString(long mTextBoxID); + + public long mTextBoxID; + + InfiniPaintTextBoxEditable() { + } + + @Override + public SpannableStringBuilder replace(int st, int en, CharSequence source, int start, int end) { + nativeReplace(mTextBoxID, st, en, source.subSequence(start, end).toString()); + return this; + } + + @Override + public SpannableStringBuilder replace(int st, int en, CharSequence text) { + return replace(st, en, text, 0, text.length()); + } + + @Override + public SpannableStringBuilder insert(int where, CharSequence text, int start, int end) { + return replace(where, where, text, start, end); + } + + @Override + public SpannableStringBuilder insert(int where, CharSequence text) { + return replace(where, where, text, 0, text.length()); + } + + @Override + public SpannableStringBuilder delete(int st, int en) { + return replace(st, en, "", 0, 0); + } + + @Override + public SpannableStringBuilder append(CharSequence text) { + return replace(length(), length(), text, 0, text.length()); + } + + @Override + public SpannableStringBuilder append(CharSequence text, int start, int end) { + return replace(length(), length(), text, start, end); + } + + @Override + public SpannableStringBuilder append(char text) { + return append(String.valueOf(text)); + } + + @Override + public void clear() { + replace(0, length(), "", 0, 0); + } + + @Override + public int length() { + return nativeGetString(mTextBoxID).length(); + } + + @Override + public char charAt(int i) { + return nativeGetString(mTextBoxID).charAt(i); + } + + @Override + public boolean isEmpty() { + return nativeGetString(mTextBoxID).isEmpty(); + } + + @Override + public CharSequence subSequence(int i, int i1) { + return nativeGetString(mTextBoxID).subSequence(i, i1); + } + + @Override + public IntStream chars() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) + return nativeGetString(mTextBoxID).chars(); + return null; + } + + @Override + public IntStream codePoints() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) + return nativeGetString(mTextBoxID).codePoints(); + return null; + } + + @Override + public void getChars(int i, int i1, char[] chars, int i2) { + nativeGetString(mTextBoxID).getChars(i, i1, chars, i2); + } +} diff --git a/android-project/app/src/main/java/com/erroratline0/infinipaint/InfiniPaintTextBoxInputConnection.java b/android-project/app/src/main/java/com/erroratline0/infinipaint/InfiniPaintTextBoxInputConnection.java index 6e61d01..9c1c4a9 100644 --- a/android-project/app/src/main/java/com/erroratline0/infinipaint/InfiniPaintTextBoxInputConnection.java +++ b/android-project/app/src/main/java/com/erroratline0/infinipaint/InfiniPaintTextBoxInputConnection.java @@ -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 . + */ + package com.erroratline0.infinipaint; import static android.text.TextUtils.CAP_MODE_SENTENCES; @@ -9,7 +27,9 @@ import android.os.Bundle; import android.os.CancellationSignal; import android.os.Handler; import android.text.Editable; +import android.text.Selection; import android.text.SpannableStringBuilder; +import android.util.Log; import android.view.*; import android.view.inputmethod.BaseInputConnection; import android.view.inputmethod.CompletionInfo; @@ -40,27 +60,38 @@ import org.libsdl.app.SDL; import org.libsdl.app.SDLActivity; public class InfiniPaintTextBoxInputConnection extends BaseInputConnection { - public static native void nativeCommitText(int textboxID, String text, int newCursorPosition); - public static native void nativeDeleteSurroundingText(int textboxID, int beforeLength, int afterLength); - public static native void nativeSetSelection(int textboxID, int start, int end); + protected InfiniPaintTextBoxEditable mEditText; + protected long mTextBoxID; - protected EditText mEditText; - protected int mTextBoxID; + public static native int[] nativeGetSelection(long mTextBoxID); + public static native void nativeShiftSelection(long mTextBoxID, int amount); + public static native void nativeSetSelection(long mTextBoxID, int start, int end); InfiniPaintTextBoxInputConnection(View targetView, boolean fullEditor) { super(targetView, fullEditor); - mEditText = new EditText(SDL.getContext()); + mEditText = new InfiniPaintTextBoxEditable(); } - public void setInitialData(int textboxID, String initialText, int begin, int end) { + public void setInitialData(long textboxID, String initialText, int begin, int end) { mTextBoxID = textboxID; - mEditText.setText(initialText); - mEditText.setSelection(begin, end); + mEditText.mTextBoxID = textboxID; + Selection.setSelection(mEditText, begin, end); + } + + public void updateSelection(int start, int end) { + Selection.setSelection(mEditText, start, end); + } + + public void clearAndSetNewTextAndSelection(String str, int start, int end) { + finishComposingText(); + mEditText.clear(); + mEditText.replace(0, 0, str); + Selection.setSelection(mEditText, start, end); } @Override public Editable getEditable() { - return mEditText.getEditableText(); + return mEditText; } @Override @@ -82,31 +113,147 @@ public class InfiniPaintTextBoxInputConnection extends BaseInputConnection { return true; } } + else if(event.getKeyCode() == KeyEvent.KEYCODE_DEL && event.getAction() == KeyEvent.ACTION_DOWN) { + int start = Selection.getSelectionStart(mEditText); + int end = Selection.getSelectionEnd(mEditText); + if(start != end) + commitText("", 0); + else { + nativeShiftSelection(mTextBoxID, -1); + int[] p = nativeGetSelection(mTextBoxID); + if(p[0] != start) + deleteSurroundingText(start - p[0], 0); + } + return true; + } + else if(event.getKeyCode() == KeyEvent.KEYCODE_DPAD_LEFT && event.getAction() == KeyEvent.ACTION_DOWN) { + leftKey(); + return true; + } + else if(event.getKeyCode() == KeyEvent.KEYCODE_DPAD_RIGHT && event.getAction() == KeyEvent.ACTION_DOWN) { + rightKey(); + return true; + } + else if(event.getKeyCode() == KeyEvent.KEYCODE_0 && event.getAction() == KeyEvent.ACTION_DOWN) { + finishComposingText(); + commitText("0", 1); + return true; + } + else if(event.getKeyCode() == KeyEvent.KEYCODE_1 && event.getAction() == KeyEvent.ACTION_DOWN) { + finishComposingText(); + commitText("1", 1); + return true; + } + else if(event.getKeyCode() == KeyEvent.KEYCODE_2 && event.getAction() == KeyEvent.ACTION_DOWN) { + finishComposingText(); + commitText("2", 1); + return true; + } + else if(event.getKeyCode() == KeyEvent.KEYCODE_3 && event.getAction() == KeyEvent.ACTION_DOWN) { + finishComposingText(); + commitText("3", 1); + return true; + } + else if(event.getKeyCode() == KeyEvent.KEYCODE_4 && event.getAction() == KeyEvent.ACTION_DOWN) { + finishComposingText(); + commitText("4", 1); + return true; + } + else if(event.getKeyCode() == KeyEvent.KEYCODE_5 && event.getAction() == KeyEvent.ACTION_DOWN) { + finishComposingText(); + commitText("5", 1); + return true; + } + else if(event.getKeyCode() == KeyEvent.KEYCODE_6 && event.getAction() == KeyEvent.ACTION_DOWN) { + finishComposingText(); + commitText("6", 1); + return true; + } + else if(event.getKeyCode() == KeyEvent.KEYCODE_7 && event.getAction() == KeyEvent.ACTION_DOWN) { + finishComposingText(); + commitText("7", 1); + return true; + } + else if(event.getKeyCode() == KeyEvent.KEYCODE_8 && event.getAction() == KeyEvent.ACTION_DOWN) { + finishComposingText(); + commitText("8", 1); + return true; + } + else if(event.getKeyCode() == KeyEvent.KEYCODE_9 && event.getAction() == KeyEvent.ACTION_DOWN) { + finishComposingText(); + commitText("9", 1); + return true; + } return super.sendKeyEvent(event); } @Override public boolean commitText(CharSequence text, int newCursorPosition) { - if (!super.commitText(text, newCursorPosition)) - return false; - nativeCommitText(mTextBoxID, text.toString(), newCursorPosition); + // Manually do commitText + int composingTextBegin = getComposingSpanStart(mEditText); + int composingTextEnd = getComposingSpanEnd(mEditText); + int start, end; + + if(composingTextBegin != -1 && composingTextEnd != -1) { + start = Math.min(composingTextBegin, composingTextEnd); + end = Math.max(composingTextBegin, composingTextEnd); + } + else { + start = Math.min(Selection.getSelectionStart(mEditText), Selection.getSelectionEnd(mEditText)); + end = Math.max(Selection.getSelectionStart(mEditText), Selection.getSelectionEnd(mEditText)); + } + + mEditText.replace(start, end, text); + if(newCursorPosition <= 0) + setSelection(start + newCursorPosition, start + newCursorPosition); + else + setSelection(start + text.length() + newCursorPosition - 1, start + text.length() + newCursorPosition - 1); return true; } @Override public boolean setComposingText(CharSequence text, int newCursorPosition) { - if (!super.setComposingText(text, newCursorPosition)) - return false; - nativeCommitText(mTextBoxID, text.toString(), newCursorPosition); + // Manually do setComposingText + int composingTextBegin = getComposingSpanStart(mEditText); + int composingTextEnd = getComposingSpanEnd(mEditText); + int start, end; + + if(composingTextBegin != -1 && composingTextEnd != -1) { + start = Math.min(composingTextBegin, composingTextEnd); + end = Math.max(composingTextBegin, composingTextEnd); + } + else { + start = Math.min(Selection.getSelectionStart(mEditText), Selection.getSelectionEnd(mEditText)); + end = Math.max(Selection.getSelectionStart(mEditText), Selection.getSelectionEnd(mEditText)); + } + mEditText.replace(start, end, text); + if(newCursorPosition <= 0) + setSelection(start + newCursorPosition, start + newCursorPosition); + else + setSelection(start + text.length() + newCursorPosition - 1, start + text.length() + newCursorPosition - 1); + + setComposingRegion(start, start + text.length()); + return true; } @Override public boolean deleteSurroundingText(int beforeLength, int afterLength) { + int start = Math.min(Selection.getSelectionStart(mEditText), Selection.getSelectionEnd(mEditText)); if (!super.deleteSurroundingText(beforeLength, afterLength)) return false; - nativeDeleteSurroundingText(mTextBoxID, beforeLength, afterLength); + int newCursorPos = Math.max(start - beforeLength, 0); + setSelection(newCursorPos, newCursorPos); + return true; + } + + @Override + public boolean deleteSurroundingTextInCodePoints(int beforeLength, int afterLength) { + if (!super.deleteSurroundingTextInCodePoints(beforeLength, afterLength)) + return false; + int[] p = nativeGetSelection(mTextBoxID); + Selection.setSelection(mEditText, p[0], p[1]); return true; } @@ -115,7 +262,29 @@ public class InfiniPaintTextBoxInputConnection extends BaseInputConnection { if(!super.setSelection(start, end)) return false; nativeSetSelection(mTextBoxID, start, end); + int[] p = nativeGetSelection(mTextBoxID); + Selection.setSelection(mEditText, p[0], p[1]); return true; } + + @Override + public boolean replaceText(int start, int end, CharSequence text, int newCursorPosition, TextAttribute textAttribute) { + finishComposingText(); + setSelection(start, end); + commitText(text, newCursorPosition); + return true; + } + + public void leftKey() { + nativeShiftSelection(mTextBoxID, -1); + int[] p = nativeGetSelection(mTextBoxID); + Selection.setSelection(mEditText, p[0], p[1]); + } + + public void rightKey() { + nativeShiftSelection(mTextBoxID, 1); + int[] p = nativeGetSelection(mTextBoxID); + Selection.setSelection(mEditText, p[0], p[1]); + } } diff --git a/android-project/app/src/main/java/com/erroratline0/infinipaint/InfiniPaintTextBoxView.java b/android-project/app/src/main/java/com/erroratline0/infinipaint/InfiniPaintTextBoxView.java index 6c1114a..e7c673b 100644 --- a/android-project/app/src/main/java/com/erroratline0/infinipaint/InfiniPaintTextBoxView.java +++ b/android-project/app/src/main/java/com/erroratline0/infinipaint/InfiniPaintTextBoxView.java @@ -1,16 +1,38 @@ +/* + * 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 . + */ + package com.erroratline0.infinipaint; import android.content.*; import android.text.InputType; +import android.text.Selection; +import android.util.Log; import android.view.*; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; -public class InfiniPaintTextBoxView extends View +import org.libsdl.app.SDLActivity; + +public class InfiniPaintTextBoxView extends View implements View.OnKeyListener { public InfiniPaintTextBoxInputConnection ic; - int mTextBoxID; + long mTextBoxID; String mStr; int mSelectionBegin; int mSelectionEnd; @@ -20,9 +42,10 @@ public class InfiniPaintTextBoxView extends View super(context); setFocusableInTouchMode(true); setFocusable(true); + setOnKeyListener(this); } - void setInitialData(int textboxID, String str, int selectionBegin, int selectionEnd, int inputType) { + void setInitialData(long textboxID, String str, int selectionBegin, int selectionEnd, int inputType) { mTextBoxID = textboxID; mStr = str; mSelectionBegin = selectionBegin; @@ -35,6 +58,23 @@ public class InfiniPaintTextBoxView extends View return true; } + @Override + public boolean onKeyPreIme (int keyCode, KeyEvent event) { + // As seen on StackOverflow: http://stackoverflow.com/questions/7634346/keyboard-hide-event + // FIXME: Discussion at http://bugzilla.libsdl.org/show_bug.cgi?id=1639 + // FIXME: This is not a 100% effective solution to the problem of detecting if the keyboard is showing or not + // FIXME: A more effective solution would be to assume our Layout to be RelativeLayout or LinearLayout + // FIXME: And determine the keyboard presence doing this: http://stackoverflow.com/questions/2150078/how-to-check-visibility-of-software-keyboard-in-android + // FIXME: An even more effective way would be if Android provided this out of the box, but where would the fun be in that :) + if (event.getAction()==KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) { + if (SDLActivity.mTextEdit2 != null && SDLActivity.mTextEdit2.getVisibility() == View.VISIBLE) { + SDLActivity.onNativeKeyboardFocusLost(); + } + } + + return super.onKeyPreIme(keyCode, event); + } + @Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { ic = new InfiniPaintTextBoxInputConnection(this, true); @@ -42,10 +82,14 @@ public class InfiniPaintTextBoxView extends View outAttrs.inputType = mInputType; outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI | - EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */ | - EditorInfo.IME_ACTION_DONE; + EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */; return ic; } + + @Override + public boolean onKey(View v, int keyCode, KeyEvent event) { + return SDLActivity.handleKeyEvent(v, keyCode, event, ic); + } } diff --git a/android-project/app/src/main/java/com/erroratline0/infinipaint/IntPair.java b/android-project/app/src/main/java/com/erroratline0/infinipaint/IntPair.java deleted file mode 100644 index 4562719..0000000 --- a/android-project/app/src/main/java/com/erroratline0/infinipaint/IntPair.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.erroratline0.infinipaint; - -public class IntPair { - IntPair() { - first = 0; - second = 0; - } - IntPair(int initFirst, int initSecond) { - first = initFirst; - second = initSecond; - } - public int first; - public int second; -} diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index d0edb48..a6be515 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -48,6 +48,8 @@ import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; +import com.erroratline0.infinipaint.InfiniPaintTextBoxView; + import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Hashtable; @@ -57,7 +59,7 @@ import java.util.Locale; /** SDL Activity */ -public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener { +public abstract class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener { private static final String TAG = "SDL"; private static final int SDL_MAJOR_VERSION = 3; private static final int SDL_MINOR_VERSION = 4; @@ -215,6 +217,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh protected static SDLActivity mSingleton; protected static SDLSurface mSurface; protected static SDLDummyEdit mTextEdit; + public static InfiniPaintTextBoxView mTextEdit2; protected static ViewGroup mLayout; protected static SDLClipboardHandler mClipboardHandler; protected static Hashtable mCursors; @@ -326,6 +329,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh mSingleton = null; mSurface = null; mTextEdit = null; + mTextEdit2 = null; mLayout = null; mClipboardHandler = null; mCursors = new Hashtable(); @@ -943,14 +947,14 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh } break; case COMMAND_TEXTEDIT_HIDE: - if (mTextEdit != null) { + if (mTextEdit2 != null) { // Note: On some devices setting view to GONE creates a flicker in landscape. // Setting the View's sizes to 0 is similar to GONE but without the flicker. // The sizes will be set to useful values when the keyboard is shown again. - mTextEdit.setLayoutParams(new RelativeLayout.LayoutParams(0, 0)); + mTextEdit2.setLayoutParams(new RelativeLayout.LayoutParams(0, 0)); InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); - imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0); + imm.hideSoftInputFromWindow(mTextEdit2.getWindowToken(), 0); onNativeScreenKeyboardHidden(); diff --git a/assets/data/icons/RemixIcon/font-serif.svg b/assets/data/icons/RemixIcon/font-serif.svg new file mode 100644 index 0000000..02292dc --- /dev/null +++ b/assets/data/icons/RemixIcon/font-serif.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/include/Helpers/CallbackManager.hpp b/include/Helpers/CallbackManager.hpp index bd93c2e..2308cdb 100644 --- a/include/Helpers/CallbackManager.hpp +++ b/include/Helpers/CallbackManager.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/include/Helpers/ConvertVec.hpp b/include/Helpers/ConvertVec.hpp index 4259f2b..cc017a8 100644 --- a/include/Helpers/ConvertVec.hpp +++ b/include/Helpers/ConvertVec.hpp @@ -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 . + */ + #pragma once #include diff --git a/include/Helpers/FileDownloader.cpp b/include/Helpers/FileDownloader.cpp index 47bac7f..b898ef7 100644 --- a/include/Helpers/FileDownloader.cpp +++ b/include/Helpers/FileDownloader.cpp @@ -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 . + */ + #include "FileDownloader.hpp" #ifndef __EMSCRIPTEN__ diff --git a/include/Helpers/FileDownloader.hpp b/include/Helpers/FileDownloader.hpp index fabac9d..b6c12d4 100644 --- a/include/Helpers/FileDownloader.hpp +++ b/include/Helpers/FileDownloader.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/include/Helpers/FileDownloaderEmscripten.cpp b/include/Helpers/FileDownloaderEmscripten.cpp index 91a3eb6..bac003a 100644 --- a/include/Helpers/FileDownloaderEmscripten.cpp +++ b/include/Helpers/FileDownloaderEmscripten.cpp @@ -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 . + */ + #ifdef __EMSCRIPTEN__ #include "FileDownloader.hpp" #include diff --git a/include/Helpers/FixedPoint.hpp b/include/Helpers/FixedPoint.hpp index e11bd61..3a66bfd 100644 --- a/include/Helpers/FixedPoint.hpp +++ b/include/Helpers/FixedPoint.hpp @@ -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 . + */ + #pragma once #include "Helpers/StringHelpers.hpp" #include diff --git a/include/Helpers/Logger.cpp b/include/Helpers/Logger.cpp index 0c623e0..c65fcd4 100644 --- a/include/Helpers/Logger.cpp +++ b/include/Helpers/Logger.cpp @@ -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 . + */ + #include "Logger.hpp" #include #include diff --git a/include/Helpers/Logger.hpp b/include/Helpers/Logger.hpp index c5e6f5b..2baff36 100644 --- a/include/Helpers/Logger.hpp +++ b/include/Helpers/Logger.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/include/Helpers/MathExtras.hpp b/include/Helpers/MathExtras.hpp index 506451c..2db3c09 100644 --- a/include/Helpers/MathExtras.hpp +++ b/include/Helpers/MathExtras.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/include/Helpers/Networking/ByteStream.cpp b/include/Helpers/Networking/ByteStream.cpp index 3dfabd0..e103084 100644 --- a/include/Helpers/Networking/ByteStream.cpp +++ b/include/Helpers/Networking/ByteStream.cpp @@ -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 . + */ + #include "ByteStream.hpp" #include #include diff --git a/include/Helpers/Networking/ByteStream.hpp b/include/Helpers/Networking/ByteStream.hpp index ca62e30..d87a9d6 100644 --- a/include/Helpers/Networking/ByteStream.hpp +++ b/include/Helpers/Networking/ByteStream.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/include/Helpers/Networking/NetClient.cpp b/include/Helpers/Networking/NetClient.cpp index 6ed5903..7fbed18 100644 --- a/include/Helpers/Networking/NetClient.cpp +++ b/include/Helpers/Networking/NetClient.cpp @@ -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 . + */ + #include "NetClient.hpp" #include "NetLibrary.hpp" #include "NetServer.hpp" diff --git a/include/Helpers/Networking/NetClient.hpp b/include/Helpers/Networking/NetClient.hpp index 63d1488..d8cabd4 100644 --- a/include/Helpers/Networking/NetClient.hpp +++ b/include/Helpers/Networking/NetClient.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/include/Helpers/Networking/NetLibrary.cpp b/include/Helpers/Networking/NetLibrary.cpp index bb6d1fd..2d8251d 100644 --- a/include/Helpers/Networking/NetLibrary.cpp +++ b/include/Helpers/Networking/NetLibrary.cpp @@ -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 . + */ + #include "NetLibrary.hpp" #include #include diff --git a/include/Helpers/Networking/NetLibrary.hpp b/include/Helpers/Networking/NetLibrary.hpp index 048c6e0..1dc56f6 100644 --- a/include/Helpers/Networking/NetLibrary.hpp +++ b/include/Helpers/Networking/NetLibrary.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/include/Helpers/Networking/NetServer.cpp b/include/Helpers/Networking/NetServer.cpp index f9e910e..cae9f4d 100644 --- a/include/Helpers/Networking/NetServer.cpp +++ b/include/Helpers/Networking/NetServer.cpp @@ -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 . + */ + #include "NetServer.hpp" #include "Helpers/Networking/ByteStream.hpp" #include "NetLibrary.hpp" diff --git a/include/Helpers/Networking/NetServer.hpp b/include/Helpers/Networking/NetServer.hpp index e64e3d9..741fba1 100644 --- a/include/Helpers/Networking/NetServer.hpp +++ b/include/Helpers/Networking/NetServer.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/include/Helpers/NetworkingObjects/DelayUpdateSerializedClassManager.cpp b/include/Helpers/NetworkingObjects/DelayUpdateSerializedClassManager.cpp index d991906..9cf99dc 100644 --- a/include/Helpers/NetworkingObjects/DelayUpdateSerializedClassManager.cpp +++ b/include/Helpers/NetworkingObjects/DelayUpdateSerializedClassManager.cpp @@ -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 . + */ + #include "DelayUpdateSerializedClassManager.hpp" #include diff --git a/include/Helpers/NetworkingObjects/DelayUpdateSerializedClassManager.hpp b/include/Helpers/NetworkingObjects/DelayUpdateSerializedClassManager.hpp index cbd6349..3a0daa6 100644 --- a/include/Helpers/NetworkingObjects/DelayUpdateSerializedClassManager.hpp +++ b/include/Helpers/NetworkingObjects/DelayUpdateSerializedClassManager.hpp @@ -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 . + */ + #pragma once #include "Helpers/Networking/NetLibrary.hpp" #include "NetObjWeakPtr.hpp" diff --git a/include/Helpers/NetworkingObjects/NetObjGenericSerializedClass.hpp b/include/Helpers/NetworkingObjects/NetObjGenericSerializedClass.hpp index 772750e..51bf75a 100644 --- a/include/Helpers/NetworkingObjects/NetObjGenericSerializedClass.hpp +++ b/include/Helpers/NetworkingObjects/NetObjGenericSerializedClass.hpp @@ -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 . + */ + #pragma once #include "NetObjTemporaryPtr.hpp" #include "cereal/archives/portable_binary.hpp" diff --git a/include/Helpers/NetworkingObjects/NetObjID.cpp b/include/Helpers/NetworkingObjects/NetObjID.cpp index 110657a..3e707c6 100644 --- a/include/Helpers/NetworkingObjects/NetObjID.cpp +++ b/include/Helpers/NetworkingObjects/NetObjID.cpp @@ -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 . + */ + #include "NetObjID.hpp" namespace NetworkingObjects { diff --git a/include/Helpers/NetworkingObjects/NetObjID.hpp b/include/Helpers/NetworkingObjects/NetObjID.hpp index c649da6..81c9d1c 100644 --- a/include/Helpers/NetworkingObjects/NetObjID.hpp +++ b/include/Helpers/NetworkingObjects/NetObjID.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/include/Helpers/NetworkingObjects/NetObjManager.cpp b/include/Helpers/NetworkingObjects/NetObjManager.cpp index 74af80a..a4d1fde 100644 --- a/include/Helpers/NetworkingObjects/NetObjManager.cpp +++ b/include/Helpers/NetworkingObjects/NetObjManager.cpp @@ -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 . + */ + #include "NetObjManager.hpp" #include "NetObjTemporaryPtr.hpp" diff --git a/include/Helpers/NetworkingObjects/NetObjManager.hpp b/include/Helpers/NetworkingObjects/NetObjManager.hpp index 0c72c84..3af9b0e 100644 --- a/include/Helpers/NetworkingObjects/NetObjManager.hpp +++ b/include/Helpers/NetworkingObjects/NetObjManager.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/include/Helpers/NetworkingObjects/NetObjManagerTypeList.cpp b/include/Helpers/NetworkingObjects/NetObjManagerTypeList.cpp index 1506c5c..ef262e9 100644 --- a/include/Helpers/NetworkingObjects/NetObjManagerTypeList.cpp +++ b/include/Helpers/NetworkingObjects/NetObjManagerTypeList.cpp @@ -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 . + */ + #include "NetObjManagerTypeList.hpp" namespace NetworkingObjects { diff --git a/include/Helpers/NetworkingObjects/NetObjManagerTypeList.hpp b/include/Helpers/NetworkingObjects/NetObjManagerTypeList.hpp index 22285e5..4624689 100644 --- a/include/Helpers/NetworkingObjects/NetObjManagerTypeList.hpp +++ b/include/Helpers/NetworkingObjects/NetObjManagerTypeList.hpp @@ -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 . + */ + #pragma once #include "../Networking/NetLibrary.hpp" #include diff --git a/include/Helpers/NetworkingObjects/NetObjOrderedList.hpp b/include/Helpers/NetworkingObjects/NetObjOrderedList.hpp index ab67db9..a7f4447 100644 --- a/include/Helpers/NetworkingObjects/NetObjOrderedList.hpp +++ b/include/Helpers/NetworkingObjects/NetObjOrderedList.hpp @@ -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 . + */ + #pragma once #include "Helpers/Networking/NetLibrary.hpp" #include "NetObjOwnerPtr.hpp" diff --git a/include/Helpers/NetworkingObjects/NetObjOwnerPtr.decl.hpp b/include/Helpers/NetworkingObjects/NetObjOwnerPtr.decl.hpp index 7fa1b73..376e2e8 100644 --- a/include/Helpers/NetworkingObjects/NetObjOwnerPtr.decl.hpp +++ b/include/Helpers/NetworkingObjects/NetObjOwnerPtr.decl.hpp @@ -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 . + */ + #pragma once #include "NetObjID.hpp" #include diff --git a/include/Helpers/NetworkingObjects/NetObjOwnerPtr.hpp b/include/Helpers/NetworkingObjects/NetObjOwnerPtr.hpp index c4aab5d..3261367 100644 --- a/include/Helpers/NetworkingObjects/NetObjOwnerPtr.hpp +++ b/include/Helpers/NetworkingObjects/NetObjOwnerPtr.hpp @@ -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 . + */ + #pragma once #include "NetObjOwnerPtr.decl.hpp" #include "NetObjOwnerPtr.impl.hpp" diff --git a/include/Helpers/NetworkingObjects/NetObjOwnerPtr.impl.hpp b/include/Helpers/NetworkingObjects/NetObjOwnerPtr.impl.hpp index 97ab120..fd4324d 100644 --- a/include/Helpers/NetworkingObjects/NetObjOwnerPtr.impl.hpp +++ b/include/Helpers/NetworkingObjects/NetObjOwnerPtr.impl.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/include/Helpers/NetworkingObjects/NetObjTemporaryPtr.decl.hpp b/include/Helpers/NetworkingObjects/NetObjTemporaryPtr.decl.hpp index cca5950..2cc2098 100644 --- a/include/Helpers/NetworkingObjects/NetObjTemporaryPtr.decl.hpp +++ b/include/Helpers/NetworkingObjects/NetObjTemporaryPtr.decl.hpp @@ -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 . + */ + #pragma once #include "NetObjID.hpp" #include diff --git a/include/Helpers/NetworkingObjects/NetObjTemporaryPtr.hpp b/include/Helpers/NetworkingObjects/NetObjTemporaryPtr.hpp index bc380d0..24daa15 100644 --- a/include/Helpers/NetworkingObjects/NetObjTemporaryPtr.hpp +++ b/include/Helpers/NetworkingObjects/NetObjTemporaryPtr.hpp @@ -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 . + */ + #pragma once #include "NetObjTemporaryPtr.decl.hpp" #include "NetObjTemporaryPtr.impl.hpp" diff --git a/include/Helpers/NetworkingObjects/NetObjTemporaryPtr.impl.hpp b/include/Helpers/NetworkingObjects/NetObjTemporaryPtr.impl.hpp index 3257b13..8122446 100644 --- a/include/Helpers/NetworkingObjects/NetObjTemporaryPtr.impl.hpp +++ b/include/Helpers/NetworkingObjects/NetObjTemporaryPtr.impl.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/include/Helpers/NetworkingObjects/NetObjUnorderedSet.hpp b/include/Helpers/NetworkingObjects/NetObjUnorderedSet.hpp index 1be67b8..e5b40cb 100644 --- a/include/Helpers/NetworkingObjects/NetObjUnorderedSet.hpp +++ b/include/Helpers/NetworkingObjects/NetObjUnorderedSet.hpp @@ -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 . + */ + #pragma once #include "Helpers/Networking/NetLibrary.hpp" #include "Helpers/NetworkingObjects/NetObjOwnerPtr.decl.hpp" diff --git a/include/Helpers/NetworkingObjects/NetObjWeakPtr.hpp b/include/Helpers/NetworkingObjects/NetObjWeakPtr.hpp index b6b1090..9d7818b 100644 --- a/include/Helpers/NetworkingObjects/NetObjWeakPtr.hpp +++ b/include/Helpers/NetworkingObjects/NetObjWeakPtr.hpp @@ -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 . + */ + #pragma once #include "NetObjID.hpp" #include "NetObjManager.hpp" diff --git a/include/Helpers/Parallel.hpp b/include/Helpers/Parallel.hpp index c3319bc..32b46bf 100644 --- a/include/Helpers/Parallel.hpp +++ b/include/Helpers/Parallel.hpp @@ -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 . + */ + #pragma once #include #ifdef __APPLE__ diff --git a/include/Helpers/Random.cpp b/include/Helpers/Random.cpp index 6f97177..f3db7ac 100644 --- a/include/Helpers/Random.cpp +++ b/include/Helpers/Random.cpp @@ -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 . + */ + #include "Random.hpp" Random Random::global; diff --git a/include/Helpers/Random.hpp b/include/Helpers/Random.hpp index abb4077..e18dcb2 100644 --- a/include/Helpers/Random.hpp +++ b/include/Helpers/Random.hpp @@ -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 . + */ + #pragma once #include diff --git a/include/Helpers/SCollision.hpp b/include/Helpers/SCollision.hpp index 9db6f6e..0d6327c 100644 --- a/include/Helpers/SCollision.hpp +++ b/include/Helpers/SCollision.hpp @@ -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 . + */ + #pragma once #include "Helpers/MathExtras.hpp" #include diff --git a/include/Helpers/StringHelpers.cpp b/include/Helpers/StringHelpers.cpp index 882141b..ac7e46c 100644 --- a/include/Helpers/StringHelpers.cpp +++ b/include/Helpers/StringHelpers.cpp @@ -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 . + */ + #include "StringHelpers.hpp" #include #include diff --git a/include/Helpers/StringHelpers.hpp b/include/Helpers/StringHelpers.hpp index 2813894..81e57cf 100644 --- a/include/Helpers/StringHelpers.hpp +++ b/include/Helpers/StringHelpers.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/include/Helpers/VersionNumber.cpp b/include/Helpers/VersionNumber.cpp index 5d88f04..8db85f2 100644 --- a/include/Helpers/VersionNumber.cpp +++ b/include/Helpers/VersionNumber.cpp @@ -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 . + */ + #include "VersionNumber.hpp" #include "StringHelpers.hpp" diff --git a/include/Helpers/VersionNumber.hpp b/include/Helpers/VersionNumber.hpp index 5067102..3a567af 100644 --- a/include/Helpers/VersionNumber.hpp +++ b/include/Helpers/VersionNumber.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/linuxinstall/com.infinipaint.infinipaint.metainfo.xml b/linuxinstall/com.infinipaint.infinipaint.metainfo.xml index 1b23da8..9860a5b 100644 --- a/linuxinstall/com.infinipaint.infinipaint.metainfo.xml +++ b/linuxinstall/com.infinipaint.infinipaint.metainfo.xml @@ -1,11 +1,11 @@ - + com.infinipaint.infinipaint Infinipaint

Draw on a big canvas CC0-1.0 - MIT + GPL-3.0-or-later #83b9b2 diff --git a/macosinstall/Info.plist b/macosinstall/Info.plist index a0a589e..d59bab5 100755 --- a/macosinstall/Info.plist +++ b/macosinstall/Info.plist @@ -19,7 +19,7 @@ CFBundlePackageType APPL NSHumanReadableCopyright - Copyright (c) 2026 Yousef Khadadeh + Copyright (C) 2025-2026 Yousef Khadadeh CFBundleDevelopmentRegion en-US CFBundleExecutable diff --git a/src/AndroidJNICalls.cpp b/src/AndroidJNICalls.cpp index ac77b7e..175c6b2 100644 --- a/src/AndroidJNICalls.cpp +++ b/src/AndroidJNICalls.cpp @@ -1,78 +1,312 @@ +/* + * 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 . + */ + #ifdef __ANDROID__ #include "AndroidJNICalls.hpp" #include #include "InputManager.hpp" #include "MainProgram.hpp" #include -#include #include +#include +#include -namespace AndroidJNICalls { - InputManager* globalInputManager; - std::mutex globalCallMutex; - - void startTextInput(int input_type) { - JNIEnv* env = static_cast(SDL_GetAndroidJNIEnv()); - Logger::get().log("INFO", std::to_string((uint64_t)env) + " jni env value"); - jobject activity = (jobject)SDL_GetAndroidActivity(); - Logger::get().log("INFO", std::to_string((uint64_t)activity) + " activity value"); - jclass clazz = env->GetObjectClass(activity); - jmethodID method_id = env->GetStaticMethodID(clazz, "startTextInput", "(I)V"); - Logger::get().log("INFO", std::to_string((uint64_t)method_id) + " method value"); - env->CallStaticVoidMethod(clazz, method_id, input_type); - env->DeleteLocalRef(activity); - env->DeleteLocalRef(clazz); - } - - void stopTextInput() { - - } -} - -jobject activity; -jmethodID startTextInputMethod; -JNIEnv* jniEnv; - -using namespace AndroidJNICalls; - - -// https://stackoverflow.com/questions/41820039/jstringjni-to-stdstringc-with-utf8-characters std::string jstring2string(JNIEnv *env, jstring jStr) { if (!jStr) return ""; - const jclass stringClass = env->GetObjectClass(jStr); - const jmethodID getBytes = env->GetMethodID(stringClass, "getBytes", "(Ljava/lang/String;)[B"); - const jbyteArray stringJbytes = (jbyteArray) env->CallObjectMethod(jStr, getBytes, env->NewStringUTF("UTF-8")); + const jchar* c = env->GetStringChars(jStr, nullptr); + if(!c) + return ""; + jsize len = env->GetStringLength(jStr); - size_t length = (size_t) env->GetArrayLength(stringJbytes); - jbyte* pBytes = env->GetByteArrayElements(stringJbytes, NULL); + SkString str = SkUnicodes::ICU::Make()->convertUtf16ToUtf8((const char16_t*)c, len); - std::string ret = std::string((char *)pBytes, length); - env->ReleaseByteArrayElements(stringJbytes, pBytes, JNI_ABORT); - - env->DeleteLocalRef(stringJbytes); - env->DeleteLocalRef(stringClass); - return ret; + return std::string(str.c_str(), str.size()); } +jstring string2jstring(JNIEnv* env, const std::string& s) { + std::u16string u16str = SkUnicodes::ICU::Make()->convertUtf8ToUtf16(s.c_str(), s.size()); + return env->NewString((const jchar*)u16str.data(), u16str.length()); +} + +namespace AndroidJNICalls { + InputManager* globalInputManager; + + std::mutex textboxMutex; + CustomEvents::InputTextBoxID textboxID = 0; + std::shared_ptr textBox; + std::shared_ptr cursor; + std::shared_ptr modMap; + bool textChanged = false; + bool cursorChanged = false; + + int get_android_text_pos_from_cursor_pos(const std::shared_ptr& t, const RichText::TextPosition& p) { + return t->get_utf16_location_from_codepoint_location(t->get_codepoint_location_from_text_position(p)); + } + + RichText::TextPosition get_cursor_pos_from_android_text_pos(const std::shared_ptr& t, int p) { + return t->get_text_position_from_codepoint_location(t->get_codepoint_location_from_utf16_location(p)); + } + + void startTextInput(CustomEvents::InputTextBoxID newTextboxID, const std::shared_ptr& newTextbox, const std::shared_ptr& newCursor, const std::shared_ptr& newModMap, int inputType) { + std::scoped_lock a{textboxMutex}; + if(!textBox) { + textBox = std::make_shared(); + cursor = std::make_shared(); + } + + textChanged = false; + cursorChanged = false; + + textboxID = newTextboxID; + textBox->set_rich_text_data(newTextbox->get_rich_text_data()); + *cursor = *newCursor; + + if(newModMap) + modMap = std::make_shared(*newModMap); + else + modMap = nullptr; + + JNIEnv* env = static_cast(SDL_GetAndroidJNIEnv()); + jobject activity = (jobject)SDL_GetAndroidActivity(); + jclass clazz = env->GetObjectClass(activity); + jmethodID method_id = env->GetStaticMethodID(clazz, "startTextInput", "(JLjava/lang/String;III)V"); + env->CallStaticVoidMethod(clazz, method_id, textboxID, string2jstring(env, textBox->get_string()), + get_android_text_pos_from_cursor_pos(textBox, std::min(cursor->selectionBeginPos, cursor->selectionEndPos)), + get_android_text_pos_from_cursor_pos(textBox, std::max(cursor->selectionBeginPos, cursor->selectionEndPos)), inputType); + env->DeleteLocalRef(activity); + env->DeleteLocalRef(clazz); + } + + void updateModMap(CustomEvents::InputTextBoxID tId, const std::shared_ptr& newModMap) { + std::scoped_lock a{textboxMutex}; + if(tId == textboxID && newModMap && modMap) + *modMap = *newModMap; + } + + void updateCursorPos(CustomEvents::InputTextBoxID tId, const std::shared_ptr& newCursor) { + std::scoped_lock a{textboxMutex}; + + if(tId == textboxID) { + *cursor = *newCursor; + + JNIEnv* env = static_cast(SDL_GetAndroidJNIEnv()); + jobject activity = (jobject)SDL_GetAndroidActivity(); + jclass clazz = env->GetObjectClass(activity); + jmethodID method_id = env->GetStaticMethodID(clazz, "updateCursorPos", "(II)V"); + env->CallStaticVoidMethod(clazz, method_id, + get_android_text_pos_from_cursor_pos(textBox, std::min(cursor->selectionBeginPos, cursor->selectionEndPos)), + get_android_text_pos_from_cursor_pos(textBox, std::max(cursor->selectionBeginPos, cursor->selectionEndPos))); + env->DeleteLocalRef(activity); + env->DeleteLocalRef(clazz); + } + } + + void updateTextboxAndCursorPos(CustomEvents::InputTextBoxID tId, const std::shared_ptr& newTextbox, const std::shared_ptr& newCursor) { + std::scoped_lock a{textboxMutex}; + + if(tId == textboxID) { + *cursor = *newCursor; + textBox->set_rich_text_data(newTextbox->get_rich_text_data()); + + JNIEnv* env = static_cast(SDL_GetAndroidJNIEnv()); + jobject activity = (jobject)SDL_GetAndroidActivity(); + jclass clazz = env->GetObjectClass(activity); + jmethodID method_id = env->GetStaticMethodID(clazz, "updateCursorPos", "(II)V"); + env->CallStaticVoidMethod(clazz, method_id, + get_android_text_pos_from_cursor_pos(textBox, std::min(cursor->selectionBeginPos, cursor->selectionEndPos)), + get_android_text_pos_from_cursor_pos(textBox, std::max(cursor->selectionBeginPos, cursor->selectionEndPos))); + env->DeleteLocalRef(activity); + env->DeleteLocalRef(clazz); + } + } + + std::pair getChangesToCommit(CustomEvents::InputTextBoxID tId) { + std::scoped_lock a{textboxMutex}; + + if(tId == textboxID) + return {textChanged, cursorChanged}; + return {false, false}; + } + + std::pair commitAll(CustomEvents::InputTextBoxID tId, const std::shared_ptr& t, const std::shared_ptr& c) { + std::scoped_lock a{textboxMutex}; + + if(tId == textboxID) { + bool oldTextChanged = textChanged; + bool oldCursorChanged = cursorChanged; + + if (textChanged) { + t->set_rich_text_data(textBox->get_rich_text_data()); + textChanged = false; + } + if (cursorChanged) { + *c = *cursor; + cursorChanged = false; + } + return {oldTextChanged, oldCursorChanged}; + } + else + return {false, false}; + } + + + struct TextInputData { + enum class CommandType { + REPLACE_TEXT, + SHIFT_CURSOR, + SET_CURSOR + } command; + std::string strData; + Vector3i intData; + }; + + void input_android_text_box(const TextInputData& textboxInput) { + switch(textboxInput.command) { + case TextInputData::CommandType::REPLACE_TEXT: { + textBox->remove(get_cursor_pos_from_android_text_pos(textBox, textboxInput.intData.x()), get_cursor_pos_from_android_text_pos(textBox, textboxInput.intData.y())); + textBox->insert(get_cursor_pos_from_android_text_pos(textBox, textboxInput.intData.x()), textboxInput.strData, modMap ? std::optional(*modMap) : std::nullopt); + textChanged = cursorChanged = true; + break; + } + case TextInputData::CommandType::SHIFT_CURSOR: { + int newCursorPosition = textboxInput.intData.x(); + cursor->pos = std::min(cursor->selectionBeginPos, cursor->selectionEndPos); + if(newCursorPosition < 0) { + for(int i = 0; i < (-newCursorPosition); i++) + cursor->selectionBeginPos = cursor->selectionEndPos = cursor->pos = textBox->move(RichText::TextBox::Movement::LEFT, cursor->pos); + } + else { + for(int i = 0; i < newCursorPosition; i++) + cursor->selectionBeginPos = cursor->selectionEndPos = cursor->pos = textBox->move(RichText::TextBox::Movement::RIGHT, cursor->pos); + } + cursorChanged = true; + break; + } + case TextInputData::CommandType::SET_CURSOR: { + cursor->selectionBeginPos = get_cursor_pos_from_android_text_pos(textBox, textboxInput.intData.x()); + cursor->selectionEndPos = cursor->pos = get_cursor_pos_from_android_text_pos(textBox, textboxInput.intData.y()); + cursorChanged = true; + break; + } + } + } +} + +jobject activity; + +using namespace AndroidJNICalls; + extern "C" JNIEXPORT void JNICALL Java_com_erroratline0_infinipaint_InfiniPaintSurface_nativeInfiniPaintUpdateIMESafeArea(JNIEnv *env, jclass clazz, jint top, jint bottom, jint left, jint right) { if(globalInputManager) { std::scoped_lock a{globalInputManager->safeAreaWithoutIMEMutex}; globalInputManager->safeAreaWithoutIME = {{left, top}, {globalInputManager->main.window.size.x() - right, globalInputManager->main.window.size.y() - bottom}}; + + SDL_Event event; + SDL_zero(event); + event.type = SDL_EVENT_WINDOW_SAFE_AREA_CHANGED; + SDL_PushEvent(&event); } } + +extern "C" +JNIEXPORT void JNICALL +Java_com_erroratline0_infinipaint_InfiniPaintTextBoxEditable_nativeReplace(JNIEnv *env, + jclass clazz, jlong id, jint st, + jint en, jstring str) { + std::scoped_lock a{textboxMutex}; + input_android_text_box({ + .command = TextInputData::CommandType::REPLACE_TEXT, + .strData = jstring2string(env, str), + .intData = {std::min(st, en), std::max(en, st), 0} + }); + CustomEvents::emit_event( + CustomEvents::AndroidTextBoxInputEvent{ + .command = CustomEvents::AndroidTextBoxInputEvent::CommandType::COMMIT_ALL, + }); +} + +extern "C" +JNIEXPORT jstring JNICALL +Java_com_erroratline0_infinipaint_InfiniPaintTextBoxEditable_nativeGetString(JNIEnv *env, + jclass clazz, jlong id) { + std::scoped_lock a{textboxMutex}; + return string2jstring(env, textBox->get_string()); +} + +extern "C" +JNIEXPORT jintArray JNICALL +Java_com_erroratline0_infinipaint_InfiniPaintTextBoxInputConnection_nativeGetSelection(JNIEnv *env, + jclass clazz, + jlong m_text_box_id) { + jintArray result; + result = env->NewIntArray(2); + jint fill[2]; + for(int i = 0; i < 2; i++) + fill[i] = 0; + + std::scoped_lock a{textboxMutex}; + + fill[0] = get_android_text_pos_from_cursor_pos(textBox, cursor->selectionBeginPos); + fill[1] = get_android_text_pos_from_cursor_pos(textBox, cursor->selectionEndPos); + + env->SetIntArrayRegion(result, 0, 2, fill); + return result; +} + extern "C" JNIEXPORT void JNICALL -Java_com_erroratline0_infinipaint_InfiniPaintTextBoxInputConnection_nativeSetTextBoxCursor( - JNIEnv *env, jclass clazz, jint cursor_begin, jint cursor_end) { - if(globalInputManager) { - std::scoped_lock a{globalCallMutex}; - globalInputManager->main.input_android_text_box_set_cursor(cursor_begin, cursor_end); - } +Java_com_erroratline0_infinipaint_InfiniPaintTextBoxInputConnection_nativeShiftSelection( + JNIEnv *env, jclass clazz, jlong m_text_box_id, jint amount) { + std::scoped_lock a{textboxMutex}; + input_android_text_box({ + .command = TextInputData::CommandType::SHIFT_CURSOR, + .strData = "", + .intData = {amount, 0, 0} + }); + + CustomEvents::emit_event( + CustomEvents::AndroidTextBoxInputEvent{ + .command = CustomEvents::AndroidTextBoxInputEvent::CommandType::COMMIT_ALL, + }); } -#endif \ No newline at end of file +extern "C" +JNIEXPORT void JNICALL +Java_com_erroratline0_infinipaint_InfiniPaintTextBoxInputConnection_nativeSetSelection(JNIEnv *env, + jclass clazz, + jlong m_text_box_id, + jint start, + jint end) { + std::scoped_lock a{textboxMutex}; + input_android_text_box({ + .command = TextInputData::CommandType::SET_CURSOR, + .intData = {std::min(start, end), std::max(start, end), 0} + }); + + CustomEvents::emit_event( + CustomEvents::AndroidTextBoxInputEvent{ + .command = CustomEvents::AndroidTextBoxInputEvent::CommandType::COMMIT_ALL, + }); +} + +#endif diff --git a/src/AndroidJNICalls.hpp b/src/AndroidJNICalls.hpp index e8cac97..4cf6fab 100644 --- a/src/AndroidJNICalls.hpp +++ b/src/AndroidJNICalls.hpp @@ -1,14 +1,37 @@ +/* + * 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 . + */ + #pragma once #ifdef __ANDROID__ #include +#include "InputManager.hpp" struct InputManager; namespace AndroidJNICalls { extern InputManager* globalInputManager; - extern std::mutex globalCallMutex; - void startTextInput(int input_type); + void startTextInput(CustomEvents::InputTextBoxID newTextboxID, const std::shared_ptr& newTextbox, const std::shared_ptr& newCursor, const std::shared_ptr& modMap, int inputType); + void updateCursorPos(CustomEvents::InputTextBoxID tId, const std::shared_ptr& newCursor); + void updateModMap(CustomEvents::InputTextBoxID tId, const std::shared_ptr& newModMap); + void updateTextboxAndCursorPos(CustomEvents::InputTextBoxID tId, const std::shared_ptr& newTextbox, const std::shared_ptr& newCursor); + std::pair getChangesToCommit(CustomEvents::InputTextBoxID tId); + std::pair commitAll(CustomEvents::InputTextBoxID tId, const std::shared_ptr& textBox, const std::shared_ptr& cursor); } #endif diff --git a/src/Bookmarks/BookmarkListItem.cpp b/src/Bookmarks/BookmarkListItem.cpp index 001b7e8..53a6c6e 100644 --- a/src/Bookmarks/BookmarkListItem.cpp +++ b/src/Bookmarks/BookmarkListItem.cpp @@ -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 . + */ + #include "BookmarkListItem.hpp" #include #include "../World.hpp" diff --git a/src/Bookmarks/BookmarkListItem.hpp b/src/Bookmarks/BookmarkListItem.hpp index 3353371..6065099 100644 --- a/src/Bookmarks/BookmarkListItem.hpp +++ b/src/Bookmarks/BookmarkListItem.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/src/Bookmarks/BookmarkManager.cpp b/src/Bookmarks/BookmarkManager.cpp index dd04931..9a37cbc 100644 --- a/src/Bookmarks/BookmarkManager.cpp +++ b/src/Bookmarks/BookmarkManager.cpp @@ -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 . + */ + #include "BookmarkManager.hpp" #include "../World.hpp" #include "../MainProgram.hpp" diff --git a/src/Bookmarks/BookmarkManager.hpp b/src/Bookmarks/BookmarkManager.hpp index 3b17ae7..46ccb44 100644 --- a/src/Bookmarks/BookmarkManager.hpp +++ b/src/Bookmarks/BookmarkManager.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/src/CanvasComponents/BrushStrokeCanvasComponent.cpp b/src/CanvasComponents/BrushStrokeCanvasComponent.cpp index 86f1b0a..4a80174 100644 --- a/src/CanvasComponents/BrushStrokeCanvasComponent.cpp +++ b/src/CanvasComponents/BrushStrokeCanvasComponent.cpp @@ -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 . + */ + #include "BrushStrokeCanvasComponent.hpp" #include #include diff --git a/src/CanvasComponents/BrushStrokeCanvasComponent.hpp b/src/CanvasComponents/BrushStrokeCanvasComponent.hpp index 5f6106a..4ae3e3a 100644 --- a/src/CanvasComponents/BrushStrokeCanvasComponent.hpp +++ b/src/CanvasComponents/BrushStrokeCanvasComponent.hpp @@ -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 . + */ + #pragma once #include "CanvasComponent.hpp" #include "Helpers/SCollision.hpp" diff --git a/src/CanvasComponents/CanvasComponent.cpp b/src/CanvasComponents/CanvasComponent.cpp index bb431fc..b77f673 100644 --- a/src/CanvasComponents/CanvasComponent.cpp +++ b/src/CanvasComponents/CanvasComponent.cpp @@ -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 . + */ + #include "CanvasComponent.hpp" #include "BrushStrokeCanvasComponent.hpp" #include "ImageCanvasComponent.hpp" diff --git a/src/CanvasComponents/CanvasComponent.hpp b/src/CanvasComponents/CanvasComponent.hpp index 9bec924..c0dbaa5 100644 --- a/src/CanvasComponents/CanvasComponent.hpp +++ b/src/CanvasComponents/CanvasComponent.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/src/CanvasComponents/CanvasComponentAllocator.cpp b/src/CanvasComponents/CanvasComponentAllocator.cpp index db81350..4773092 100644 --- a/src/CanvasComponents/CanvasComponentAllocator.cpp +++ b/src/CanvasComponents/CanvasComponentAllocator.cpp @@ -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 . + */ + #include "CanvasComponentAllocator.hpp" #include "CanvasComponentContainer.hpp" #include "../DrawingProgram/DrawingProgram.hpp" diff --git a/src/CanvasComponents/CanvasComponentAllocator.hpp b/src/CanvasComponents/CanvasComponentAllocator.hpp index 09cc428..1744e2d 100644 --- a/src/CanvasComponents/CanvasComponentAllocator.hpp +++ b/src/CanvasComponents/CanvasComponentAllocator.hpp @@ -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 . + */ + #pragma once #include #include "CanvasComponentType.hpp" diff --git a/src/CanvasComponents/CanvasComponentContainer.cpp b/src/CanvasComponents/CanvasComponentContainer.cpp index 83b2f52..dde845f 100644 --- a/src/CanvasComponents/CanvasComponentContainer.cpp +++ b/src/CanvasComponents/CanvasComponentContainer.cpp @@ -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 . + */ + #include "CanvasComponentContainer.hpp" #include "CanvasComponentAllocator.hpp" #include "../DrawData.hpp" diff --git a/src/CanvasComponents/CanvasComponentContainer.hpp b/src/CanvasComponents/CanvasComponentContainer.hpp index c9fef5a..b3c7cea 100644 --- a/src/CanvasComponents/CanvasComponentContainer.hpp +++ b/src/CanvasComponents/CanvasComponentContainer.hpp @@ -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 . + */ + #pragma once #include "../CoordSpaceHelper.hpp" #include diff --git a/src/CanvasComponents/CanvasComponentType.hpp b/src/CanvasComponents/CanvasComponentType.hpp index 9dac1e6..73eca7b 100644 --- a/src/CanvasComponents/CanvasComponentType.hpp +++ b/src/CanvasComponents/CanvasComponentType.hpp @@ -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 . + */ + #pragma once #include diff --git a/src/CanvasComponents/EllipseCanvasComponent.cpp b/src/CanvasComponents/EllipseCanvasComponent.cpp index 7687640..7079ca4 100644 --- a/src/CanvasComponents/EllipseCanvasComponent.cpp +++ b/src/CanvasComponents/EllipseCanvasComponent.cpp @@ -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 . + */ + #include "EllipseCanvasComponent.hpp" #include "CanvasComponent.hpp" #include "Helpers/ConvertVec.hpp" diff --git a/src/CanvasComponents/EllipseCanvasComponent.hpp b/src/CanvasComponents/EllipseCanvasComponent.hpp index ddf1564..df610a5 100644 --- a/src/CanvasComponents/EllipseCanvasComponent.hpp +++ b/src/CanvasComponents/EllipseCanvasComponent.hpp @@ -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 . + */ + #pragma once #include "CanvasComponent.hpp" #include "../CoordSpaceHelper.hpp" diff --git a/src/CanvasComponents/ImageCanvasComponent.cpp b/src/CanvasComponents/ImageCanvasComponent.cpp index e6175b2..e7009ea 100644 --- a/src/CanvasComponents/ImageCanvasComponent.cpp +++ b/src/CanvasComponents/ImageCanvasComponent.cpp @@ -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 . + */ + #include "ImageCanvasComponent.hpp" #include "Eigen/Core" #include "Helpers/ConvertVec.hpp" diff --git a/src/CanvasComponents/ImageCanvasComponent.hpp b/src/CanvasComponents/ImageCanvasComponent.hpp index 6710b01..83479f3 100644 --- a/src/CanvasComponents/ImageCanvasComponent.hpp +++ b/src/CanvasComponents/ImageCanvasComponent.hpp @@ -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 . + */ + #pragma once #include "../SharedTypes.hpp" #include "CanvasComponent.hpp" diff --git a/src/CanvasComponents/RectangleCanvasComponent.cpp b/src/CanvasComponents/RectangleCanvasComponent.cpp index 85addbf..33a1632 100644 --- a/src/CanvasComponents/RectangleCanvasComponent.cpp +++ b/src/CanvasComponents/RectangleCanvasComponent.cpp @@ -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 . + */ + #include "RectangleCanvasComponent.hpp" #include "Helpers/ConvertVec.hpp" #include "Helpers/MathExtras.hpp" diff --git a/src/CanvasComponents/RectangleCanvasComponent.hpp b/src/CanvasComponents/RectangleCanvasComponent.hpp index e4f115d..b627402 100644 --- a/src/CanvasComponents/RectangleCanvasComponent.hpp +++ b/src/CanvasComponents/RectangleCanvasComponent.hpp @@ -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 . + */ + #pragma once #include "../SharedTypes.hpp" #include "CanvasComponent.hpp" diff --git a/src/CanvasComponents/TextBoxCanvasComponent.cpp b/src/CanvasComponents/TextBoxCanvasComponent.cpp index 5080859..8be6894 100644 --- a/src/CanvasComponents/TextBoxCanvasComponent.cpp +++ b/src/CanvasComponents/TextBoxCanvasComponent.cpp @@ -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 . + */ + #include "TextBoxCanvasComponent.hpp" #include "Helpers/ConvertVec.hpp" #include diff --git a/src/CanvasComponents/TextBoxCanvasComponent.hpp b/src/CanvasComponents/TextBoxCanvasComponent.hpp index 1bfd941..bd2723d 100644 --- a/src/CanvasComponents/TextBoxCanvasComponent.hpp +++ b/src/CanvasComponents/TextBoxCanvasComponent.hpp @@ -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 . + */ + #pragma once #include "../SharedTypes.hpp" #include "CanvasComponent.hpp" diff --git a/src/CanvasTheme.cpp b/src/CanvasTheme.cpp index 799b5aa..9421323 100644 --- a/src/CanvasTheme.cpp +++ b/src/CanvasTheme.cpp @@ -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 . + */ + #include "CanvasTheme.hpp" #include "DrawingProgram/DrawingProgram.hpp" #include diff --git a/src/CanvasTheme.hpp b/src/CanvasTheme.hpp index a4d9ee6..e99a52b 100644 --- a/src/CanvasTheme.hpp +++ b/src/CanvasTheme.hpp @@ -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 . + */ + #pragma once #include "cereal/archives/portable_binary.hpp" #include diff --git a/src/ClientData.cpp b/src/ClientData.cpp index d3928e6..13988f4 100644 --- a/src/ClientData.cpp +++ b/src/ClientData.cpp @@ -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 . + */ + #include "ClientData.hpp" #include "CommandList.hpp" #include "World.hpp" diff --git a/src/ClientData.hpp b/src/ClientData.hpp index ea22933..3a4f1da 100644 --- a/src/ClientData.hpp +++ b/src/ClientData.hpp @@ -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 . + */ + #pragma once #include #include "CoordSpaceHelper.hpp" diff --git a/src/CommandList.hpp b/src/CommandList.hpp index 463e6af..38b04cf 100644 --- a/src/CommandList.hpp +++ b/src/CommandList.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/src/CoordSpaceHelper.cpp b/src/CoordSpaceHelper.cpp index 58223d9..98f1d2b 100644 --- a/src/CoordSpaceHelper.cpp +++ b/src/CoordSpaceHelper.cpp @@ -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 . + */ + #include "CoordSpaceHelper.hpp" #include "MainProgram.hpp" #include diff --git a/src/CoordSpaceHelper.hpp b/src/CoordSpaceHelper.hpp index c637c14..966348b 100644 --- a/src/CoordSpaceHelper.hpp +++ b/src/CoordSpaceHelper.hpp @@ -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 . + */ + #pragma once #include "SharedTypes.hpp" #include diff --git a/src/CoordSpaceHelperTransform.cpp b/src/CoordSpaceHelperTransform.cpp index 4435197..f6e44b2 100644 --- a/src/CoordSpaceHelperTransform.cpp +++ b/src/CoordSpaceHelperTransform.cpp @@ -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 . + */ + #include "CoordSpaceHelperTransform.hpp" #include "CoordSpaceHelper.hpp" #include "nlohmann/json.hpp" diff --git a/src/CoordSpaceHelperTransform.hpp b/src/CoordSpaceHelperTransform.hpp index bdb8025..47b05a7 100644 --- a/src/CoordSpaceHelperTransform.hpp +++ b/src/CoordSpaceHelperTransform.hpp @@ -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 . + */ + #pragma once #include "SharedTypes.hpp" #include diff --git a/src/CustomEvents.cpp b/src/CustomEvents.cpp index 8740cbd..c868945 100644 --- a/src/CustomEvents.cpp +++ b/src/CustomEvents.cpp @@ -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 . + */ + #include "CustomEvents.hpp" #include #include @@ -5,6 +23,12 @@ namespace CustomEvents { + InputTextBoxID text_box_get_new_id() { + static InputTextBoxID nextID = 0; + ++nextID; + return nextID; + } + std::queue> eventDataQueue; std::mutex eventDataQueueMutex; @@ -16,6 +40,7 @@ void init() { OpenInfiniPaintFileEvent::EVENT_NUM = SDL_RegisterEvents(1); AddFileToCanvasEvent::EVENT_NUM = SDL_RegisterEvents(1); RefreshTextBoxInputEvent::EVENT_NUM = SDL_RegisterEvents(1); + AndroidTextBoxInputEvent::EVENT_NUM = SDL_RegisterEvents(1); alreadyInitialized = true; } } @@ -24,5 +49,6 @@ uint32_t PasteEvent::EVENT_NUM; uint32_t OpenInfiniPaintFileEvent::EVENT_NUM; uint32_t AddFileToCanvasEvent::EVENT_NUM; uint32_t RefreshTextBoxInputEvent::EVENT_NUM; +uint32_t AndroidTextBoxInputEvent::EVENT_NUM; } diff --git a/src/CustomEvents.hpp b/src/CustomEvents.hpp index 76bd934..d41a4af 100644 --- a/src/CustomEvents.hpp +++ b/src/CustomEvents.hpp @@ -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 . + */ + #pragma once #include #include @@ -7,11 +25,15 @@ #include #include #include +#include #include "RichText/TextBox.hpp" namespace CustomEvents { void init(); + typedef int64_t InputTextBoxID; + InputTextBoxID text_box_get_new_id(); + extern std::queue> eventDataQueue; extern std::mutex eventDataQueueMutex; @@ -71,4 +93,19 @@ namespace CustomEvents { struct RefreshTextBoxInputEvent { static uint32_t EVENT_NUM; }; + + struct AndroidTextBoxInputEvent { + static uint32_t EVENT_NUM; + InputTextBoxID textboxID; + enum class CommandType { + COMMIT_ALL + } command; + std::string strData; + Vector3i intData; + }; + + struct AndroidInsetsChangedEvent { + static uint32_t EVENT_NUM; + SCollision::AABB safeWindowRect; + }; } diff --git a/src/DrawCamera.cpp b/src/DrawCamera.cpp index 294b82b..696077d 100755 --- a/src/DrawCamera.cpp +++ b/src/DrawCamera.cpp @@ -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 . + */ + #include "DrawCamera.hpp" #include "DrawingProgram/Tools/DrawingProgramToolBase.hpp" #include "Helpers/FixedPoint.hpp" diff --git a/src/DrawCamera.hpp b/src/DrawCamera.hpp index 26a6aed..2bfdd0c 100644 --- a/src/DrawCamera.hpp +++ b/src/DrawCamera.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/src/DrawCollision.cpp b/src/DrawCollision.cpp index ecf34a4..66de17b 100644 --- a/src/DrawCollision.cpp +++ b/src/DrawCollision.cpp @@ -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 . + */ + #include "DrawCollision.hpp" #include #include diff --git a/src/DrawCollision.hpp b/src/DrawCollision.hpp index 75453e9..64bf083 100644 --- a/src/DrawCollision.hpp +++ b/src/DrawCollision.hpp @@ -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 . + */ + #pragma once #include #include "DrawData.hpp" diff --git a/src/DrawData.cpp b/src/DrawData.cpp index c9e197d..86d6ca6 100644 --- a/src/DrawData.cpp +++ b/src/DrawData.cpp @@ -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 . + */ + #include "DrawData.hpp" #include "CanvasComponents/CanvasComponentContainer.hpp" diff --git a/src/DrawData.hpp b/src/DrawData.hpp index a4af1ec..3ec472f 100644 --- a/src/DrawData.hpp +++ b/src/DrawData.hpp @@ -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 . + */ + #pragma once #include "DrawCamera.hpp" #include "ResourceManager.hpp" diff --git a/src/DrawingProgram/DrawingProgram.cpp b/src/DrawingProgram/DrawingProgram.cpp index cc5e9ed..7938248 100644 --- a/src/DrawingProgram/DrawingProgram.cpp +++ b/src/DrawingProgram/DrawingProgram.cpp @@ -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 . + */ + #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_setcolor_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); diff --git a/src/DrawingProgram/DrawingProgram.hpp b/src/DrawingProgram/DrawingProgram.hpp index b206039..92363cc 100644 --- a/src/DrawingProgram/DrawingProgram.hpp +++ b/src/DrawingProgram/DrawingProgram.hpp @@ -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 . + */ + #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& 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); diff --git a/src/DrawingProgram/DrawingProgramCache.cpp b/src/DrawingProgram/DrawingProgramCache.cpp index 6b3dc90..51cb60a 100644 --- a/src/DrawingProgram/DrawingProgramCache.cpp +++ b/src/DrawingProgram/DrawingProgramCache.cpp @@ -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 . + */ + #include "DrawingProgramCache.hpp" #include "DrawingProgram.hpp" #include "../World.hpp" diff --git a/src/DrawingProgram/DrawingProgramCache.hpp b/src/DrawingProgram/DrawingProgramCache.hpp index 0fd434f..385c4a6 100644 --- a/src/DrawingProgram/DrawingProgramCache.hpp +++ b/src/DrawingProgram/DrawingProgramCache.hpp @@ -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 . + */ + #pragma once #include "../CanvasComponents/CanvasComponentContainer.hpp" #include diff --git a/src/DrawingProgram/DrawingProgramSelection.cpp b/src/DrawingProgram/DrawingProgramSelection.cpp index 60f36a4..9473e22 100644 --- a/src/DrawingProgram/DrawingProgramSelection.cpp +++ b/src/DrawingProgram/DrawingProgramSelection.cpp @@ -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 . + */ + #include "DrawingProgramSelection.hpp" #include "DrawingProgram.hpp" #include "../World.hpp" diff --git a/src/DrawingProgram/DrawingProgramSelection.hpp b/src/DrawingProgram/DrawingProgramSelection.hpp index 112a589..04b93ee 100644 --- a/src/DrawingProgram/DrawingProgramSelection.hpp +++ b/src/DrawingProgram/DrawingProgramSelection.hpp @@ -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 . + */ + #pragma once #include "../CoordSpaceHelperTransform.hpp" #include "Layers/DrawingProgramLayerManager.hpp" diff --git a/src/DrawingProgram/Layers/DrawingProgramLayer.cpp b/src/DrawingProgram/Layers/DrawingProgramLayer.cpp index f0c011d..7cb573d 100644 --- a/src/DrawingProgram/Layers/DrawingProgramLayer.cpp +++ b/src/DrawingProgram/Layers/DrawingProgramLayer.cpp @@ -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 . + */ + #include "DrawingProgramLayer.hpp" #include "DrawingProgramLayerManager.hpp" #include "../DrawingProgram.hpp" diff --git a/src/DrawingProgram/Layers/DrawingProgramLayer.hpp b/src/DrawingProgram/Layers/DrawingProgramLayer.hpp index 5194544..6cb8110 100644 --- a/src/DrawingProgram/Layers/DrawingProgramLayer.hpp +++ b/src/DrawingProgram/Layers/DrawingProgramLayer.hpp @@ -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 . + */ + #pragma once #include #include "../../CanvasComponents/CanvasComponent.hpp" diff --git a/src/DrawingProgram/Layers/DrawingProgramLayerFolder.cpp b/src/DrawingProgram/Layers/DrawingProgramLayerFolder.cpp index 037ef98..c841be3 100644 --- a/src/DrawingProgram/Layers/DrawingProgramLayerFolder.cpp +++ b/src/DrawingProgram/Layers/DrawingProgramLayerFolder.cpp @@ -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 . + */ + #include "DrawingProgramLayerFolder.hpp" #include "DrawingProgramLayerListItem.hpp" #include "DrawingProgramLayer.hpp" diff --git a/src/DrawingProgram/Layers/DrawingProgramLayerFolder.hpp b/src/DrawingProgram/Layers/DrawingProgramLayerFolder.hpp index 5ca12f7..e6e6d80 100644 --- a/src/DrawingProgram/Layers/DrawingProgramLayerFolder.hpp +++ b/src/DrawingProgram/Layers/DrawingProgramLayerFolder.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/src/DrawingProgram/Layers/DrawingProgramLayerListItem.cpp b/src/DrawingProgram/Layers/DrawingProgramLayerListItem.cpp index 12b147e..e62a702 100644 --- a/src/DrawingProgram/Layers/DrawingProgramLayerListItem.cpp +++ b/src/DrawingProgram/Layers/DrawingProgramLayerListItem.cpp @@ -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 . + */ + #include "DrawingProgramLayerListItem.hpp" #include "DrawingProgramLayerFolder.hpp" #include diff --git a/src/DrawingProgram/Layers/DrawingProgramLayerListItem.hpp b/src/DrawingProgram/Layers/DrawingProgramLayerListItem.hpp index 9663628..25b70bd 100644 --- a/src/DrawingProgram/Layers/DrawingProgramLayerListItem.hpp +++ b/src/DrawingProgram/Layers/DrawingProgramLayerListItem.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/src/DrawingProgram/Layers/DrawingProgramLayerManager.cpp b/src/DrawingProgram/Layers/DrawingProgramLayerManager.cpp index c3cd72a..cb88def 100644 --- a/src/DrawingProgram/Layers/DrawingProgramLayerManager.cpp +++ b/src/DrawingProgram/Layers/DrawingProgramLayerManager.cpp @@ -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 . + */ + #include "DrawingProgramLayerManager.hpp" #include "../../World.hpp" #include "Helpers/NetworkingObjects/NetObjID.hpp" diff --git a/src/DrawingProgram/Layers/DrawingProgramLayerManager.hpp b/src/DrawingProgram/Layers/DrawingProgramLayerManager.hpp index f8c30c4..391d8f5 100644 --- a/src/DrawingProgram/Layers/DrawingProgramLayerManager.hpp +++ b/src/DrawingProgram/Layers/DrawingProgramLayerManager.hpp @@ -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 . + */ + #pragma once #include "DrawingProgramLayerListItem.hpp" #include "DrawingProgramLayerManagerGUI.hpp" diff --git a/src/DrawingProgram/Layers/DrawingProgramLayerManagerGUI.cpp b/src/DrawingProgram/Layers/DrawingProgramLayerManagerGUI.cpp index 62a819b..82087d8 100644 --- a/src/DrawingProgram/Layers/DrawingProgramLayerManagerGUI.cpp +++ b/src/DrawingProgram/Layers/DrawingProgramLayerManagerGUI.cpp @@ -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 . + */ + #include "DrawingProgramLayerManagerGUI.hpp" #include "DrawingProgramLayerListItem.hpp" #include "DrawingProgramLayerManager.hpp" diff --git a/src/DrawingProgram/Layers/DrawingProgramLayerManagerGUI.hpp b/src/DrawingProgram/Layers/DrawingProgramLayerManagerGUI.hpp index dbb75f5..4fe692f 100644 --- a/src/DrawingProgram/Layers/DrawingProgramLayerManagerGUI.hpp +++ b/src/DrawingProgram/Layers/DrawingProgramLayerManagerGUI.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/src/DrawingProgram/Layers/SerializedBlendMode.cpp b/src/DrawingProgram/Layers/SerializedBlendMode.cpp index e079e52..c9e3be9 100644 --- a/src/DrawingProgram/Layers/SerializedBlendMode.cpp +++ b/src/DrawingProgram/Layers/SerializedBlendMode.cpp @@ -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 . + */ + #include "SerializedBlendMode.hpp" #include diff --git a/src/DrawingProgram/Layers/SerializedBlendMode.hpp b/src/DrawingProgram/Layers/SerializedBlendMode.hpp index 9cf0eba..eaba2b1 100644 --- a/src/DrawingProgram/Layers/SerializedBlendMode.hpp +++ b/src/DrawingProgram/Layers/SerializedBlendMode.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/src/DrawingProgram/ToolConfiguration.cpp b/src/DrawingProgram/ToolConfiguration.cpp index 0571c46..ab11730 100644 --- a/src/DrawingProgram/ToolConfiguration.cpp +++ b/src/DrawingProgram/ToolConfiguration.cpp @@ -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 . + */ + #include "ToolConfiguration.hpp" #include "DrawingProgram.hpp" #include "../World.hpp" diff --git a/src/DrawingProgram/ToolConfiguration.hpp b/src/DrawingProgram/ToolConfiguration.hpp index 6d20488..842255c 100644 --- a/src/DrawingProgram/ToolConfiguration.hpp +++ b/src/DrawingProgram/ToolConfiguration.hpp @@ -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 . + */ + #pragma once #include "../SharedTypes.hpp" #include "nlohmann/json.hpp" diff --git a/src/DrawingProgram/Tools/BrushTool.cpp b/src/DrawingProgram/Tools/BrushTool.cpp index c56cf34..947784e 100644 --- a/src/DrawingProgram/Tools/BrushTool.cpp +++ b/src/DrawingProgram/Tools/BrushTool.cpp @@ -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 . + */ + #include "BrushTool.hpp" #include #include "../../GUIStuff/GUIManager.hpp" diff --git a/src/DrawingProgram/Tools/BrushTool.hpp b/src/DrawingProgram/Tools/BrushTool.hpp index bb9f088..bef5bca 100644 --- a/src/DrawingProgram/Tools/BrushTool.hpp +++ b/src/DrawingProgram/Tools/BrushTool.hpp @@ -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 . + */ + #pragma once #include "DrawingProgramToolBase.hpp" #include diff --git a/src/DrawingProgram/Tools/DrawingProgramToolBase.cpp b/src/DrawingProgram/Tools/DrawingProgramToolBase.cpp index 530b5c8..529ff01 100644 --- a/src/DrawingProgram/Tools/DrawingProgramToolBase.cpp +++ b/src/DrawingProgram/Tools/DrawingProgramToolBase.cpp @@ -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 . + */ + #include "DrawingProgramToolBase.hpp" #include "BrushTool.hpp" @@ -55,7 +73,9 @@ std::unique_ptr 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 DrawingProgramToolBase::get_text_box_start_info() { return std::nullopt; } diff --git a/src/DrawingProgram/Tools/DrawingProgramToolBase.hpp b/src/DrawingProgram/Tools/DrawingProgramToolBase.hpp index 7db536c..8a6ebad 100644 --- a/src/DrawingProgram/Tools/DrawingProgramToolBase.hpp +++ b/src/DrawingProgram/Tools/DrawingProgramToolBase.hpp @@ -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 . + */ + #pragma once #include #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 get_text_box_start_info(); virtual ~DrawingProgramToolBase(); static std::unique_ptr allocate_tool_type(DrawingProgram& drawP, DrawingProgramToolType t); diff --git a/src/DrawingProgram/Tools/EditTool.cpp b/src/DrawingProgram/Tools/EditTool.cpp index c4f00a8..76fa9d1 100644 --- a/src/DrawingProgram/Tools/EditTool.cpp +++ b/src/DrawingProgram/Tools/EditTool.cpp @@ -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 . + */ + #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(); } diff --git a/src/DrawingProgram/Tools/EditTool.hpp b/src/DrawingProgram/Tools/EditTool.hpp index fc1a1bf..2ceba18 100644 --- a/src/DrawingProgram/Tools/EditTool.hpp +++ b/src/DrawingProgram/Tools/EditTool.hpp @@ -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 . + */ + #pragma once #include "DrawingProgramToolBase.hpp" #include @@ -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; diff --git a/src/DrawingProgram/Tools/EditTools/BrushEditTool.cpp b/src/DrawingProgram/Tools/EditTools/BrushEditTool.cpp index ad2d6e2..9481d0a 100644 --- a/src/DrawingProgram/Tools/EditTools/BrushEditTool.cpp +++ b/src/DrawingProgram/Tools/EditTools/BrushEditTool.cpp @@ -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 . + */ + #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(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(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(comp->obj->get_comp()); oldColor = a.d.color; diff --git a/src/DrawingProgram/Tools/EditTools/BrushEditTool.hpp b/src/DrawingProgram/Tools/EditTools/BrushEditTool.hpp index 4f8fef1..41706f1 100644 --- a/src/DrawingProgram/Tools/EditTools/BrushEditTool.hpp +++ b/src/DrawingProgram/Tools/EditTools/BrushEditTool.hpp @@ -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 . + */ + #pragma once #include "DrawingProgramEditToolBase.hpp" #include @@ -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; }; diff --git a/src/DrawingProgram/Tools/EditTools/DrawingProgramEditToolBase.cpp b/src/DrawingProgram/Tools/EditTools/DrawingProgramEditToolBase.cpp index 548c707..e0ef216 100644 --- a/src/DrawingProgram/Tools/EditTools/DrawingProgramEditToolBase.cpp +++ b/src/DrawingProgram/Tools/EditTools/DrawingProgramEditToolBase.cpp @@ -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 . + */ + #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 DrawingProgramEditToolBase::get_text_box_start_info() { return std::nullopt; } DrawingProgramEditToolBase::~DrawingProgramEditToolBase() {} diff --git a/src/DrawingProgram/Tools/EditTools/DrawingProgramEditToolBase.hpp b/src/DrawingProgram/Tools/EditTools/DrawingProgramEditToolBase.hpp index 1be5229..0066152 100644 --- a/src/DrawingProgram/Tools/EditTools/DrawingProgramEditToolBase.hpp +++ b/src/DrawingProgram/Tools/EditTools/DrawingProgramEditToolBase.hpp @@ -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 . + */ + #pragma once #include #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); diff --git a/src/DrawingProgram/Tools/EditTools/EllipseDrawEditTool.cpp b/src/DrawingProgram/Tools/EditTools/EllipseDrawEditTool.cpp index b696dc4..a91eedd 100644 --- a/src/DrawingProgram/Tools/EditTools/EllipseDrawEditTool.cpp +++ b/src/DrawingProgram/Tools/EditTools/EllipseDrawEditTool.cpp @@ -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 . + */ + #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(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(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(comp->obj->get_comp()); diff --git a/src/DrawingProgram/Tools/EditTools/EllipseDrawEditTool.hpp b/src/DrawingProgram/Tools/EditTools/EllipseDrawEditTool.hpp index dd37b6b..a0be16d 100644 --- a/src/DrawingProgram/Tools/EditTools/EllipseDrawEditTool.hpp +++ b/src/DrawingProgram/Tools/EditTools/EllipseDrawEditTool.hpp @@ -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 . + */ + #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(); diff --git a/src/DrawingProgram/Tools/EditTools/ImageEditTool.cpp b/src/DrawingProgram/Tools/EditTools/ImageEditTool.cpp index 81d6896..0daf950 100644 --- a/src/DrawingProgram/Tools/EditTools/ImageEditTool.cpp +++ b/src/DrawingProgram/Tools/EditTools/ImageEditTool.cpp @@ -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 . + */ + #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(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(a.d.imageID); + if(resourceData) + text_label(gui, "Name: " + resourceData->name); + else + text_label_centered(gui, "Loading resource..."); + }); +} diff --git a/src/DrawingProgram/Tools/EditTools/ImageEditTool.hpp b/src/DrawingProgram/Tools/EditTools/ImageEditTool.hpp index b7ace84..f3dcd8b 100644 --- a/src/DrawingProgram/Tools/EditTools/ImageEditTool.hpp +++ b/src/DrawingProgram/Tools/EditTools/ImageEditTool.hpp @@ -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 . + */ + #pragma once #include "DrawingProgramEditToolBase.hpp" #include @@ -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; }; diff --git a/src/DrawingProgram/Tools/EditTools/RectDrawEditTool.cpp b/src/DrawingProgram/Tools/EditTools/RectDrawEditTool.cpp index dc18c51..25576e0 100644 --- a/src/DrawingProgram/Tools/EditTools/RectDrawEditTool.cpp +++ b/src/DrawingProgram/Tools/EditTools/RectDrawEditTool.cpp @@ -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 . + */ + #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(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(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(comp->obj->get_comp()); prevData = a.d; diff --git a/src/DrawingProgram/Tools/EditTools/RectDrawEditTool.hpp b/src/DrawingProgram/Tools/EditTools/RectDrawEditTool.hpp index 5018349..bafeef4 100644 --- a/src/DrawingProgram/Tools/EditTools/RectDrawEditTool.hpp +++ b/src/DrawingProgram/Tools/EditTools/RectDrawEditTool.hpp @@ -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 . + */ + #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 oldData; }; diff --git a/src/DrawingProgram/Tools/EditTools/TextBoxEditTool.cpp b/src/DrawingProgram/Tools/EditTools/TextBoxEditTool.cpp index 780b0e4..f936054 100644 --- a/src/DrawingProgram/Tools/EditTools/TextBoxEditTool.cpp +++ b/src/DrawingProgram/Tools/EditTools/TextBoxEditTool.cpp @@ -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 . + */ + #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(std::vector{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(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(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(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(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(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(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(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(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("bottom toolbar", [&](LayoutElement*, const Clay_ElementId& lId) { + CLAY(lId, { + .layout = { + .sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0)} + }, + .backgroundColor = convert_vec4(io.theme->backColor1), + .cornerRadius = CLAY_CORNER_RADIUS(io.theme->windowCorners1) + }) { + gui.clipping_element("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(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(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(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(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("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(std::vector{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(std::vector{SkString{FontPicker::sorted_font_list(gui)[i].c_str(), FontPicker::sorted_font_list(gui)[i].size()}}); + + gui.element("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(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(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(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& 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(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(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(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(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(comp->obj->get_comp()); SCollision::ColliderCollection 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(comp->obj->get_comp()); a.init_text_box(drawP); - if(!isDraggingPoint) { + if(!isDraggingPoint && userInput) { auto& a = static_cast(comp->obj->get_comp()); SCollision::ColliderCollection 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 TextBoxEditTool::get_text_box_start_info() { if(userInput) { + auto& a = static_cast(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 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(drawP.world.main.input.text_box_get_new_id(), textbox, cur, currentModsPtr); + userInput = std::make_unique(CustomEvents::text_box_get_new_id(), textbox, cur, currentModsPtr); CustomEvents::emit_event(CustomEvents::RefreshTextBoxInputEvent{}); } diff --git a/src/DrawingProgram/Tools/EditTools/TextBoxEditTool.hpp b/src/DrawingProgram/Tools/EditTools/TextBoxEditTool.hpp index 988a79a..a63f0ee 100644 --- a/src/DrawingProgram/Tools/EditTools/TextBoxEditTool.hpp +++ b/src/DrawingProgram/Tools/EditTools/TextBoxEditTool.hpp @@ -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 . + */ + #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 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 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& 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> undoHeldData; std::shared_ptr currentModsPtr = std::make_shared(); - std::vector sortedFontList; - TextBoxEditToolAllData get_all_data(const TextBoxCanvasComponent& a); }; diff --git a/src/DrawingProgram/Tools/EllipseDrawTool.cpp b/src/DrawingProgram/Tools/EllipseDrawTool.cpp index 633443a..c405f48 100644 --- a/src/DrawingProgram/Tools/EllipseDrawTool.cpp +++ b/src/DrawingProgram/Tools/EllipseDrawTool.cpp @@ -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 . + */ + #include "EllipseDrawTool.hpp" #include "../DrawingProgram.hpp" #include "../../MainProgram.hpp" diff --git a/src/DrawingProgram/Tools/EllipseDrawTool.hpp b/src/DrawingProgram/Tools/EllipseDrawTool.hpp index 8be5a01..0a719bb 100644 --- a/src/DrawingProgram/Tools/EllipseDrawTool.hpp +++ b/src/DrawingProgram/Tools/EllipseDrawTool.hpp @@ -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 . + */ + #pragma once #include "DrawingProgramToolBase.hpp" #include diff --git a/src/DrawingProgram/Tools/EraserTool.cpp b/src/DrawingProgram/Tools/EraserTool.cpp index e7c65e0..8ed6d79 100644 --- a/src/DrawingProgram/Tools/EraserTool.cpp +++ b/src/DrawingProgram/Tools/EraserTool.cpp @@ -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 . + */ + #include "EraserTool.hpp" #include "../DrawingProgram.hpp" #include "../../MainProgram.hpp" diff --git a/src/DrawingProgram/Tools/EraserTool.hpp b/src/DrawingProgram/Tools/EraserTool.hpp index 2fad49c..5f02eec 100644 --- a/src/DrawingProgram/Tools/EraserTool.hpp +++ b/src/DrawingProgram/Tools/EraserTool.hpp @@ -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 . + */ + #pragma once #include #include "../../DrawData.hpp" diff --git a/src/DrawingProgram/Tools/EyeDropperTool.cpp b/src/DrawingProgram/Tools/EyeDropperTool.cpp index f012fef..139974f 100644 --- a/src/DrawingProgram/Tools/EyeDropperTool.cpp +++ b/src/DrawingProgram/Tools/EyeDropperTool.cpp @@ -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 . + */ + #include "EyeDropperTool.hpp" #include "../DrawingProgram.hpp" #include "../../MainProgram.hpp" diff --git a/src/DrawingProgram/Tools/EyeDropperTool.hpp b/src/DrawingProgram/Tools/EyeDropperTool.hpp index 64e8edb..ecf3d7a 100644 --- a/src/DrawingProgram/Tools/EyeDropperTool.hpp +++ b/src/DrawingProgram/Tools/EyeDropperTool.hpp @@ -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 . + */ + #pragma once #include "DrawingProgramToolBase.hpp" diff --git a/src/DrawingProgram/Tools/GridModifyTool.cpp b/src/DrawingProgram/Tools/GridModifyTool.cpp index 4f46e0a..25da419 100644 --- a/src/DrawingProgram/Tools/GridModifyTool.cpp +++ b/src/DrawingProgram/Tools/GridModifyTool.cpp @@ -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 . + */ + #include "GridModifyTool.hpp" #include "../DrawingProgram.hpp" #include "../../MainProgram.hpp" diff --git a/src/DrawingProgram/Tools/GridModifyTool.hpp b/src/DrawingProgram/Tools/GridModifyTool.hpp index 08a2c93..c8e7332 100644 --- a/src/DrawingProgram/Tools/GridModifyTool.hpp +++ b/src/DrawingProgram/Tools/GridModifyTool.hpp @@ -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 . + */ + #pragma once #include "DrawingProgramToolBase.hpp" #include "../../WorldGrid.hpp" diff --git a/src/DrawingProgram/Tools/LassoSelectTool.cpp b/src/DrawingProgram/Tools/LassoSelectTool.cpp index b323149..4c99e4c 100644 --- a/src/DrawingProgram/Tools/LassoSelectTool.cpp +++ b/src/DrawingProgram/Tools/LassoSelectTool.cpp @@ -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 . + */ + #include "LassoSelectTool.hpp" #include "../DrawingProgram.hpp" #include "../../MainProgram.hpp" diff --git a/src/DrawingProgram/Tools/LassoSelectTool.hpp b/src/DrawingProgram/Tools/LassoSelectTool.hpp index bc6dc58..a490e1b 100644 --- a/src/DrawingProgram/Tools/LassoSelectTool.hpp +++ b/src/DrawingProgram/Tools/LassoSelectTool.hpp @@ -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 . + */ + #pragma once #include #include "../../DrawData.hpp" diff --git a/src/DrawingProgram/Tools/LineDrawTool.cpp b/src/DrawingProgram/Tools/LineDrawTool.cpp index 743c237..9848f1d 100644 --- a/src/DrawingProgram/Tools/LineDrawTool.cpp +++ b/src/DrawingProgram/Tools/LineDrawTool.cpp @@ -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 . + */ + #include "LineDrawTool.hpp" #include "../DrawingProgram.hpp" #include "../../MainProgram.hpp" diff --git a/src/DrawingProgram/Tools/LineDrawTool.hpp b/src/DrawingProgram/Tools/LineDrawTool.hpp index 33c0bde..3c557e2 100644 --- a/src/DrawingProgram/Tools/LineDrawTool.hpp +++ b/src/DrawingProgram/Tools/LineDrawTool.hpp @@ -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 . + */ + #pragma once #include "DrawingProgramToolBase.hpp" #include diff --git a/src/DrawingProgram/Tools/PanCanvasTool.cpp b/src/DrawingProgram/Tools/PanCanvasTool.cpp index d00e5ae..a9e5dfb 100644 --- a/src/DrawingProgram/Tools/PanCanvasTool.cpp +++ b/src/DrawingProgram/Tools/PanCanvasTool.cpp @@ -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 . + */ + #include "PanCanvasTool.hpp" #include "../DrawingProgram.hpp" #include "../../MainProgram.hpp" diff --git a/src/DrawingProgram/Tools/PanCanvasTool.hpp b/src/DrawingProgram/Tools/PanCanvasTool.hpp index ec82d96..09363aa 100644 --- a/src/DrawingProgram/Tools/PanCanvasTool.hpp +++ b/src/DrawingProgram/Tools/PanCanvasTool.hpp @@ -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 . + */ + #pragma once #include "DrawingProgramToolBase.hpp" diff --git a/src/DrawingProgram/Tools/RectDrawTool.cpp b/src/DrawingProgram/Tools/RectDrawTool.cpp index 0b40f9a..760df66 100644 --- a/src/DrawingProgram/Tools/RectDrawTool.cpp +++ b/src/DrawingProgram/Tools/RectDrawTool.cpp @@ -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 . + */ + #include "RectDrawTool.hpp" #include "../DrawingProgram.hpp" #include "../../MainProgram.hpp" diff --git a/src/DrawingProgram/Tools/RectDrawTool.hpp b/src/DrawingProgram/Tools/RectDrawTool.hpp index b469125..bae46b6 100644 --- a/src/DrawingProgram/Tools/RectDrawTool.hpp +++ b/src/DrawingProgram/Tools/RectDrawTool.hpp @@ -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 . + */ + #pragma once #include "DrawingProgramToolBase.hpp" #include diff --git a/src/DrawingProgram/Tools/RectSelectTool.cpp b/src/DrawingProgram/Tools/RectSelectTool.cpp index 80a6307..ce745ac 100644 --- a/src/DrawingProgram/Tools/RectSelectTool.cpp +++ b/src/DrawingProgram/Tools/RectSelectTool.cpp @@ -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 . + */ + #include "RectSelectTool.hpp" #include "../DrawingProgram.hpp" #include "../../MainProgram.hpp" diff --git a/src/DrawingProgram/Tools/RectSelectTool.hpp b/src/DrawingProgram/Tools/RectSelectTool.hpp index d220e5e..a11cff3 100644 --- a/src/DrawingProgram/Tools/RectSelectTool.hpp +++ b/src/DrawingProgram/Tools/RectSelectTool.hpp @@ -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 . + */ + #pragma once #include "DrawingProgramToolBase.hpp" #include diff --git a/src/DrawingProgram/Tools/ScreenshotTool.cpp b/src/DrawingProgram/Tools/ScreenshotTool.cpp index 7a8c62d..4900753 100644 --- a/src/DrawingProgram/Tools/ScreenshotTool.cpp +++ b/src/DrawingProgram/Tools/ScreenshotTool.cpp @@ -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 . + */ + #include "ScreenshotTool.hpp" #include "../DrawingProgram.hpp" #include "../../MainProgram.hpp" diff --git a/src/DrawingProgram/Tools/ScreenshotTool.hpp b/src/DrawingProgram/Tools/ScreenshotTool.hpp index 7c2d6b0..92a3dff 100644 --- a/src/DrawingProgram/Tools/ScreenshotTool.hpp +++ b/src/DrawingProgram/Tools/ScreenshotTool.hpp @@ -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 . + */ + #pragma once #include "DrawingProgramToolBase.hpp" #include diff --git a/src/DrawingProgram/Tools/TextBoxTool.cpp b/src/DrawingProgram/Tools/TextBoxTool.cpp index b52b46d..f66918b 100644 --- a/src/DrawingProgram/Tools/TextBoxTool.cpp +++ b/src/DrawingProgram/Tools/TextBoxTool.cpp @@ -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 . + */ + #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) { diff --git a/src/DrawingProgram/Tools/TextBoxTool.hpp b/src/DrawingProgram/Tools/TextBoxTool.hpp index 5ab5197..b4bcda9 100644 --- a/src/DrawingProgram/Tools/TextBoxTool.hpp +++ b/src/DrawingProgram/Tools/TextBoxTool.hpp @@ -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 . + */ + #pragma once #include "DrawingProgramToolBase.hpp" #include diff --git a/src/DrawingProgram/Tools/ZoomCanvasTool.cpp b/src/DrawingProgram/Tools/ZoomCanvasTool.cpp index 31678ed..30403a8 100644 --- a/src/DrawingProgram/Tools/ZoomCanvasTool.cpp +++ b/src/DrawingProgram/Tools/ZoomCanvasTool.cpp @@ -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 . + */ + #include "ZoomCanvasTool.hpp" #include "../DrawingProgram.hpp" #include "../../MainProgram.hpp" diff --git a/src/DrawingProgram/Tools/ZoomCanvasTool.hpp b/src/DrawingProgram/Tools/ZoomCanvasTool.hpp index 4dc3a36..4dff0c3 100644 --- a/src/DrawingProgram/Tools/ZoomCanvasTool.hpp +++ b/src/DrawingProgram/Tools/ZoomCanvasTool.hpp @@ -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 . + */ + #pragma once #include "DrawingProgramToolBase.hpp" diff --git a/src/FileHelpers.cpp b/src/FileHelpers.cpp index 9455f36..2a5907a 100644 --- a/src/FileHelpers.cpp +++ b/src/FileHelpers.cpp @@ -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 . + */ + #include "FileHelpers.hpp" #include #include diff --git a/src/FileHelpers.hpp b/src/FileHelpers.hpp index 02b9536..a201740 100644 --- a/src/FileHelpers.hpp +++ b/src/FileHelpers.hpp @@ -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 . + */ + #pragma once #include diff --git a/src/FontData.cpp b/src/FontData.cpp index 7ce2ff8..f9076ad 100644 --- a/src/FontData.cpp +++ b/src/FontData.cpp @@ -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 . + */ + #include "FontData.hpp" #include #include diff --git a/src/FontData.hpp b/src/FontData.hpp index 4c1e2ef..5cdd3bf 100644 --- a/src/FontData.hpp +++ b/src/FontData.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/src/GUIHolder.cpp b/src/GUIHolder.cpp index 841c221..dd54a57 100644 --- a/src/GUIHolder.cpp +++ b/src/GUIHolder.cpp @@ -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 . + */ + #include "GUIHolder.hpp" #include #include @@ -126,6 +144,10 @@ void GUIHolder::input_paste_callback(const CustomEvents::PasteEvent& paste) { gui.input_paste_callback(paste); } +void GUIHolder::input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput) { + gui.input_android_text_box_input_callback(textboxInput); +} + void GUIHolder::input_text_key_callback(const InputManager::KeyCallbackArgs& key) { gui.input_text_key_callback(key); } diff --git a/src/GUIHolder.hpp b/src/GUIHolder.hpp index 047dca4..7da824f 100644 --- a/src/GUIHolder.hpp +++ b/src/GUIHolder.hpp @@ -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 . + */ + #pragma once #include "CustomEvents.hpp" @@ -22,6 +40,7 @@ class GUIHolder { void draw(SkCanvas* canvas, bool skiaAA); void input_paste_callback(const CustomEvents::PasteEvent& paste); + void input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput); void input_text_key_callback(const InputManager::KeyCallbackArgs& key); void input_text_callback(const InputManager::TextCallbackArgs& text); void input_key_callback(const InputManager::KeyCallbackArgs& key); diff --git a/src/GUIStuff/ClayImplement.cpp b/src/GUIStuff/ClayImplement.cpp index 1ff0eb0..402a532 100644 --- a/src/GUIStuff/ClayImplement.cpp +++ b/src/GUIStuff/ClayImplement.cpp @@ -1,2 +1,20 @@ +/* + * 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 . + */ + #define CLAY_IMPLEMENTATION #include diff --git a/src/GUIStuff/ElementHelpers/ButtonHelpers.cpp b/src/GUIStuff/ElementHelpers/ButtonHelpers.cpp index 8b1fd09..3478507 100644 --- a/src/GUIStuff/ElementHelpers/ButtonHelpers.cpp +++ b/src/GUIStuff/ElementHelpers/ButtonHelpers.cpp @@ -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 . + */ + #include "ButtonHelpers.hpp" #include "../Elements/SVGIcon.hpp" #include "../Elements/LayoutElement.hpp" diff --git a/src/GUIStuff/ElementHelpers/ButtonHelpers.hpp b/src/GUIStuff/ElementHelpers/ButtonHelpers.hpp index c99312c..1d77883 100644 --- a/src/GUIStuff/ElementHelpers/ButtonHelpers.hpp +++ b/src/GUIStuff/ElementHelpers/ButtonHelpers.hpp @@ -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 . + */ + #pragma once #include "../GUIManager.hpp" #include "../Elements/SelectableButton.hpp" diff --git a/src/GUIStuff/ElementHelpers/CheckBoxHelpers.cpp b/src/GUIStuff/ElementHelpers/CheckBoxHelpers.cpp index 161cbfb..11f2df9 100644 --- a/src/GUIStuff/ElementHelpers/CheckBoxHelpers.cpp +++ b/src/GUIStuff/ElementHelpers/CheckBoxHelpers.cpp @@ -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 . + */ + #include "CheckBoxHelpers.hpp" #include "LayoutHelpers.hpp" #include "TextLabelHelpers.hpp" diff --git a/src/GUIStuff/ElementHelpers/CheckBoxHelpers.hpp b/src/GUIStuff/ElementHelpers/CheckBoxHelpers.hpp index 33fc304..5b6057a 100644 --- a/src/GUIStuff/ElementHelpers/CheckBoxHelpers.hpp +++ b/src/GUIStuff/ElementHelpers/CheckBoxHelpers.hpp @@ -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 . + */ + #pragma once #include "../GUIManager.hpp" diff --git a/src/GUIStuff/ElementHelpers/ColorPickerHelpers.hpp b/src/GUIStuff/ElementHelpers/ColorPickerHelpers.hpp index f152d6d..9533a14 100644 --- a/src/GUIStuff/ElementHelpers/ColorPickerHelpers.hpp +++ b/src/GUIStuff/ElementHelpers/ColorPickerHelpers.hpp @@ -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 . + */ + #pragma once #include "ColorPickerItemsHelpers.hpp" #include "../Elements/ColorPickerButton.hpp" diff --git a/src/GUIStuff/ElementHelpers/ColorPickerItemsHelpers.hpp b/src/GUIStuff/ElementHelpers/ColorPickerItemsHelpers.hpp index 70d8ff0..4044331 100644 --- a/src/GUIStuff/ElementHelpers/ColorPickerItemsHelpers.hpp +++ b/src/GUIStuff/ElementHelpers/ColorPickerItemsHelpers.hpp @@ -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 . + */ + #pragma once #include "../GUIManager.hpp" #include "TextBoxHelpers.hpp" diff --git a/src/GUIStuff/ElementHelpers/DropdownHelpers.hpp b/src/GUIStuff/ElementHelpers/DropdownHelpers.hpp new file mode 100644 index 0000000..2f4c5f7 --- /dev/null +++ b/src/GUIStuff/ElementHelpers/DropdownHelpers.hpp @@ -0,0 +1,53 @@ +/* + * 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 . + */ + +#pragma once +#include "../GUIManager.hpp" +#include "../Elements/DropDown.hpp" + +namespace GUIStuff { namespace ElementHelpers { + +template void number_dropdown(GUIManager& gui, const char* id, T* data, int32_t minData, int32_t maxData, int32_t step, const std::function& onChange = nullptr) { + std::vector dropdownStrings; + size_t closestSelectionDistance = std::numeric_limits::max(); + std::shared_ptr currentSelection = std::make_shared(0); + { + size_t i = 0; + for(int32_t newSelection = minData; newSelection <= maxData; newSelection += step) { + size_t newDistance = std::abs(static_cast(*data) - newSelection); + if(newDistance < closestSelectionDistance) { + closestSelectionDistance = newDistance; + *currentSelection = i; + } + dropdownStrings.emplace_back(std::to_string(newSelection)); + i++; + } + } + + gui.element>(id, currentSelection.get(), dropdownStrings, DropdownOptions{ + .onClick = [minData, step, data, onChange, currentSelection] { + int32_t newVal = minData; + for(size_t i = 0; i < *currentSelection; i++) + newVal += step; + *data = static_cast(newVal); + if(onChange) onChange(); + } + }); +} + +}} diff --git a/src/GUIStuff/ElementHelpers/LayoutHelpers.cpp b/src/GUIStuff/ElementHelpers/LayoutHelpers.cpp index 6a720a5..5615692 100644 --- a/src/GUIStuff/ElementHelpers/LayoutHelpers.cpp +++ b/src/GUIStuff/ElementHelpers/LayoutHelpers.cpp @@ -1,6 +1,25 @@ +/* + * 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 . + */ + #include "LayoutHelpers.hpp" #include "../Elements/LayoutElement.hpp" #include "Helpers/ConvertVec.hpp" +#include "../Elements/ManyElementScrollArea.hpp" namespace GUIStuff { namespace ElementHelpers { @@ -213,4 +232,130 @@ void window_gap_side_bar(GUIManager& gui, const WindowFillSideBarConfig::Directi } } +void bottom_offset_setup(GUIManager& gui, float dropdownHeight, Clay_FloatingElementConfig& floatConfig, float& maxHeight, const DropDownPopupLayout& d) { + auto& bb = d.button->get_bb().value(); + + float xOffset = bb.center().x() - d.entrySize.x() * 0.5f; + + if(xOffset < 0.0f) + xOffset = 0.0f; + else if(xOffset + d.entrySize.x() > gui.io.safeWindowRect.max.x()) + xOffset = gui.io.safeWindowRect.max.x() - d.entrySize.x(); + + floatConfig = { + .offset = { + .x = xOffset, + .y = bb.max.y() + d.dropdownOffset + }, + .zIndex = gui.get_z_index(), + .attachPoints = { + .element = CLAY_ATTACH_POINT_LEFT_TOP, + .parent = CLAY_ATTACH_POINT_LEFT_TOP + }, + .attachTo = CLAY_ATTACH_TO_ROOT + }; + + maxHeight = std::max(gui.io.safeWindowRect.max.y() - bb.max.y() - d.dropdownOffset, 0.0f); +} + +void top_offset_setup(GUIManager& gui, float dropdownHeight, Clay_FloatingElementConfig& floatConfig, float& maxHeight, const DropDownPopupLayout& d) { + auto& bb = d.button->get_bb().value(); + + float xOffset = bb.center().x() - d.entrySize.x() * 0.5f; + + if(xOffset < 0.0f) + xOffset = 0.0f; + else if(xOffset + d.entrySize.x() > gui.io.safeWindowRect.max.x()) + xOffset = gui.io.safeWindowRect.max.x() - d.entrySize.x(); + + floatConfig = { + .offset = { + .x = xOffset, + .y = bb.min.y() - d.dropdownOffset + }, + .zIndex = gui.get_z_index(), + .attachPoints = { + .element = CLAY_ATTACH_POINT_LEFT_BOTTOM, + .parent = CLAY_ATTACH_POINT_LEFT_TOP + }, + .attachTo = CLAY_ATTACH_TO_ROOT + }; + + maxHeight = std::max(bb.min.y() - gui.io.safeWindowRect.min.y() - d.dropdownOffset, 0.0f); +} + +void left_right_offset_setup(GUIManager& gui, float dropdownHeight, Clay_FloatingElementConfig& floatConfig, float& maxHeight, bool isRightSide, const DropDownPopupLayout& d) { + auto& bb = d.button->get_bb().value(); + float offsetY = bb.center().y() - dropdownHeight * 0.5f; + if(dropdownHeight >= gui.io.safeWindowRect.height() || offsetY < gui.io.safeWindowRect.min.y()) + offsetY = gui.io.safeWindowRect.min.y(); + else if(offsetY + dropdownHeight > gui.io.safeWindowRect.max.y()) + offsetY -= (offsetY + dropdownHeight) - gui.io.safeWindowRect.max.y(); + floatConfig = { + .offset = { + .x = isRightSide ? bb.max.x() + d.dropdownOffset : bb.min.x() - bb.width() - d.dropdownOffset, + .y = offsetY + }, + .zIndex = gui.get_z_index(), + .attachPoints = { + .element = CLAY_ATTACH_POINT_LEFT_TOP, + .parent = CLAY_ATTACH_POINT_LEFT_TOP + }, + .attachTo = CLAY_ATTACH_TO_ROOT + }; + maxHeight = gui.io.safeWindowRect.height(); +} + +void dropdown_many_element_popup_layout(GUIManager& gui, const char* id, const DropDownPopupLayout& d) { + if(!d.button->get_bb().has_value()) + return; + gui.element(id, [&](LayoutElement* l, const Clay_ElementId& lId) { + float dropdownHeight = d.entrySize.y() * d.entryCount + d.dropdownOffset; + Clay_FloatingElementConfig floatConfig; + float maxHeight = gui.io.safeWindowRect.height(); + auto& buttonBB = d.button->get_bb().value(); + if(buttonBB.max.y() + dropdownHeight > gui.io.safeWindowRect.max.y()) { + float rightSideWidth = gui.io.safeWindowRect.max.x() - buttonBB.max.x(); + float leftSideWidth = buttonBB.min.x() - gui.io.safeWindowRect.min.x(); + if(rightSideWidth > d.entrySize.x() || leftSideWidth > d.entrySize.x()) + left_right_offset_setup(gui, dropdownHeight, floatConfig, maxHeight, rightSideWidth >= leftSideWidth, d); + else { + if(gui.io.safeWindowRect.max.y() - buttonBB.max.y() >= buttonBB.min.y() - gui.io.safeWindowRect.min.y()) + bottom_offset_setup(gui, dropdownHeight, floatConfig, maxHeight, d); + else + top_offset_setup(gui, dropdownHeight, floatConfig, maxHeight, d); + } + } + else + bottom_offset_setup(gui, dropdownHeight, floatConfig, maxHeight, d); + CLAY(lId, { + .layout = { + .sizing = {.width = CLAY_SIZING_FIXED(d.entrySize.x()), .height = CLAY_SIZING_FIT(0, maxHeight)}, + .childGap = 0 + }, + .backgroundColor = convert_vec4(gui.io.theme->backColor1), + .cornerRadius = CLAY_CORNER_RADIUS(4), + .floating = floatConfig, + .border = { + .color = convert_vec4(gui.io.theme->fillColor2), + .width = CLAY_BORDER_OUTSIDE(1) + } + }) { + gui.element("dropdown scroll area", ManyElementScrollArea::Options{ + .entryHeight = d.entrySize.y(), + .entryCount = d.entryCount, + .clipHorizontal = true, + .elementContent = d.entryLayout + }); + } + }, LayoutElement::Callbacks { + .onClick = [&, d](LayoutElement* l, const InputManager::MouseButtonCallbackArgs& m) { + if(!l->mouseHovering && !l->childMouseHovering && m.down && !d.button->mouseHovering && d.isOpen) { + *d.isOpen = false; + gui.set_to_layout(); + } + } + }); +} + }} diff --git a/src/GUIStuff/ElementHelpers/LayoutHelpers.hpp b/src/GUIStuff/ElementHelpers/LayoutHelpers.hpp index a7da200..b328497 100644 --- a/src/GUIStuff/ElementHelpers/LayoutHelpers.hpp +++ b/src/GUIStuff/ElementHelpers/LayoutHelpers.hpp @@ -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 . + */ + #pragma once #include "../GUIManager.hpp" #include "../Elements/LayoutElement.hpp" @@ -23,4 +41,15 @@ struct WindowFillSideBarConfig { void window_fill_side_bar(GUIManager& gui, const WindowFillSideBarConfig& config, const std::function& innerContent); void window_gap_side_bar(GUIManager& gui, const WindowFillSideBarConfig::Direction& dir); +struct DropDownPopupLayout { + float dropdownOffset = 4.0f; + Element* button = nullptr; + bool* isOpen; + Vector2f entrySize; + size_t entryCount; + std::function entryLayout; +}; + +void dropdown_many_element_popup_layout(GUIManager& gui, const char* id, const DropDownPopupLayout& d); + }} diff --git a/src/GUIStuff/ElementHelpers/NumberSliderHelpers.hpp b/src/GUIStuff/ElementHelpers/NumberSliderHelpers.hpp index bd5ec84..0bfaf0e 100644 --- a/src/GUIStuff/ElementHelpers/NumberSliderHelpers.hpp +++ b/src/GUIStuff/ElementHelpers/NumberSliderHelpers.hpp @@ -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 . + */ + #pragma once #include "../GUIManager.hpp" #include "TextBoxHelpers.hpp" diff --git a/src/GUIStuff/ElementHelpers/PopupHelpers.cpp b/src/GUIStuff/ElementHelpers/PopupHelpers.cpp index 19ac737..0f76f1d 100644 --- a/src/GUIStuff/ElementHelpers/PopupHelpers.cpp +++ b/src/GUIStuff/ElementHelpers/PopupHelpers.cpp @@ -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 . + */ + #include "PopupHelpers.hpp" namespace GUIStuff { namespace ElementHelpers { diff --git a/src/GUIStuff/ElementHelpers/PopupHelpers.hpp b/src/GUIStuff/ElementHelpers/PopupHelpers.hpp index 7fdc614..a6fcac5 100644 --- a/src/GUIStuff/ElementHelpers/PopupHelpers.hpp +++ b/src/GUIStuff/ElementHelpers/PopupHelpers.hpp @@ -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 . + */ + #pragma once #include "../GUIManager.hpp" #include "../Elements/PaintCircleMenu.hpp" diff --git a/src/GUIStuff/ElementHelpers/RadioButtonHelpers.cpp b/src/GUIStuff/ElementHelpers/RadioButtonHelpers.cpp index 51dfdf4..f3b839e 100644 --- a/src/GUIStuff/ElementHelpers/RadioButtonHelpers.cpp +++ b/src/GUIStuff/ElementHelpers/RadioButtonHelpers.cpp @@ -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 . + */ + #include "RadioButtonHelpers.hpp" #include "../Elements/RadioButton.hpp" #include "LayoutHelpers.hpp" diff --git a/src/GUIStuff/ElementHelpers/RadioButtonHelpers.hpp b/src/GUIStuff/ElementHelpers/RadioButtonHelpers.hpp index a7b0b4f..269629b 100644 --- a/src/GUIStuff/ElementHelpers/RadioButtonHelpers.hpp +++ b/src/GUIStuff/ElementHelpers/RadioButtonHelpers.hpp @@ -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 . + */ + #pragma once #include "../GUIManager.hpp" diff --git a/src/GUIStuff/ElementHelpers/TextBoxHelpers.cpp b/src/GUIStuff/ElementHelpers/TextBoxHelpers.cpp index 658f535..680a8a3 100644 --- a/src/GUIStuff/ElementHelpers/TextBoxHelpers.cpp +++ b/src/GUIStuff/ElementHelpers/TextBoxHelpers.cpp @@ -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 . + */ + #include "TextBoxHelpers.hpp" #include "LayoutHelpers.hpp" diff --git a/src/GUIStuff/ElementHelpers/TextBoxHelpers.hpp b/src/GUIStuff/ElementHelpers/TextBoxHelpers.hpp index 8ba9405..5776f1e 100644 --- a/src/GUIStuff/ElementHelpers/TextBoxHelpers.hpp +++ b/src/GUIStuff/ElementHelpers/TextBoxHelpers.hpp @@ -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 . + */ + #pragma once #include "../GUIManager.hpp" #include "../Elements/TextBox.hpp" diff --git a/src/GUIStuff/ElementHelpers/TextLabelHelpers.cpp b/src/GUIStuff/ElementHelpers/TextLabelHelpers.cpp index 081742a..3a482fd 100644 --- a/src/GUIStuff/ElementHelpers/TextLabelHelpers.cpp +++ b/src/GUIStuff/ElementHelpers/TextLabelHelpers.cpp @@ -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 . + */ + #include "TextLabelHelpers.hpp" #include "../Elements/MutableTextLabel.hpp" #include "Helpers/ConvertVec.hpp" diff --git a/src/GUIStuff/ElementHelpers/TextLabelHelpers.hpp b/src/GUIStuff/ElementHelpers/TextLabelHelpers.hpp index 8a8d3e9..a2ee966 100644 --- a/src/GUIStuff/ElementHelpers/TextLabelHelpers.hpp +++ b/src/GUIStuff/ElementHelpers/TextLabelHelpers.hpp @@ -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 . + */ + #pragma once #include "../GUIManager.hpp" diff --git a/src/GUIStuff/Elements/AlphaSlider.cpp b/src/GUIStuff/Elements/AlphaSlider.cpp index 9e714bf..c9b2024 100644 --- a/src/GUIStuff/Elements/AlphaSlider.cpp +++ b/src/GUIStuff/Elements/AlphaSlider.cpp @@ -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 . + */ + #include "AlphaSlider.hpp" #include "../GUIManager.hpp" #include "ColorPicker.hpp" diff --git a/src/GUIStuff/Elements/AlphaSlider.hpp b/src/GUIStuff/Elements/AlphaSlider.hpp index bb8eef6..bd36a75 100644 --- a/src/GUIStuff/Elements/AlphaSlider.hpp +++ b/src/GUIStuff/Elements/AlphaSlider.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" diff --git a/src/GUIStuff/Elements/CheckBox.cpp b/src/GUIStuff/Elements/CheckBox.cpp index 64234e3..04a58a6 100644 --- a/src/GUIStuff/Elements/CheckBox.cpp +++ b/src/GUIStuff/Elements/CheckBox.cpp @@ -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 . + */ + #include "CheckBox.hpp" #include #include diff --git a/src/GUIStuff/Elements/CheckBox.hpp b/src/GUIStuff/Elements/CheckBox.hpp index b8747ea..8d8963b 100644 --- a/src/GUIStuff/Elements/CheckBox.hpp +++ b/src/GUIStuff/Elements/CheckBox.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" diff --git a/src/GUIStuff/Elements/ColorPicker.decl.hpp b/src/GUIStuff/Elements/ColorPicker.decl.hpp index 1be99a6..1f5c0ef 100644 --- a/src/GUIStuff/Elements/ColorPicker.decl.hpp +++ b/src/GUIStuff/Elements/ColorPicker.decl.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" #include diff --git a/src/GUIStuff/Elements/ColorPicker.hpp b/src/GUIStuff/Elements/ColorPicker.hpp index d45c611..a3c6d7e 100644 --- a/src/GUIStuff/Elements/ColorPicker.hpp +++ b/src/GUIStuff/Elements/ColorPicker.hpp @@ -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 . + */ + #pragma once #include "ColorPicker.decl.hpp" #include "ColorPicker.impl.hpp" diff --git a/src/GUIStuff/Elements/ColorPicker.impl.hpp b/src/GUIStuff/Elements/ColorPicker.impl.hpp index 8957237..8b138ae 100644 --- a/src/GUIStuff/Elements/ColorPicker.impl.hpp +++ b/src/GUIStuff/Elements/ColorPicker.impl.hpp @@ -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 . + */ + #pragma once #include "ColorPicker.decl.hpp" #include "../GUIManager.hpp" diff --git a/src/GUIStuff/Elements/ColorPickerButton.decl.hpp b/src/GUIStuff/Elements/ColorPickerButton.decl.hpp index 476efd9..53886ad 100644 --- a/src/GUIStuff/Elements/ColorPickerButton.decl.hpp +++ b/src/GUIStuff/Elements/ColorPickerButton.decl.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" diff --git a/src/GUIStuff/Elements/ColorPickerButton.hpp b/src/GUIStuff/Elements/ColorPickerButton.hpp index 52564ed..483bc3a 100644 --- a/src/GUIStuff/Elements/ColorPickerButton.hpp +++ b/src/GUIStuff/Elements/ColorPickerButton.hpp @@ -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 . + */ + #pragma once #include "ColorPickerButton.decl.hpp" #include "ColorPickerButton.impl.hpp" diff --git a/src/GUIStuff/Elements/ColorPickerButton.impl.hpp b/src/GUIStuff/Elements/ColorPickerButton.impl.hpp index 26b6e47..6518ea4 100644 --- a/src/GUIStuff/Elements/ColorPickerButton.impl.hpp +++ b/src/GUIStuff/Elements/ColorPickerButton.impl.hpp @@ -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 . + */ + #include "ColorPickerButton.decl.hpp" #include "../ElementHelpers/ColorPickerItemsHelpers.hpp" #include "../ElementHelpers/ButtonHelpers.hpp" diff --git a/src/GUIStuff/Elements/ColorPickerShaders.cpp b/src/GUIStuff/Elements/ColorPickerShaders.cpp index 950ce4f..953d5e0 100644 --- a/src/GUIStuff/Elements/ColorPickerShaders.cpp +++ b/src/GUIStuff/Elements/ColorPickerShaders.cpp @@ -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 . + */ + #include "ColorPicker.decl.hpp" #include diff --git a/src/GUIStuff/Elements/ColorRectangleDisplay.cpp b/src/GUIStuff/Elements/ColorRectangleDisplay.cpp index 048eff7..9c106ab 100644 --- a/src/GUIStuff/Elements/ColorRectangleDisplay.cpp +++ b/src/GUIStuff/Elements/ColorRectangleDisplay.cpp @@ -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 . + */ + #include "ColorRectangleDisplay.hpp" #include "../GUIManager.hpp" diff --git a/src/GUIStuff/Elements/ColorRectangleDisplay.hpp b/src/GUIStuff/Elements/ColorRectangleDisplay.hpp index 5e97579..14f6974 100644 --- a/src/GUIStuff/Elements/ColorRectangleDisplay.hpp +++ b/src/GUIStuff/Elements/ColorRectangleDisplay.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" #include diff --git a/src/GUIStuff/Elements/DropDown.hpp b/src/GUIStuff/Elements/DropDown.hpp index d07d7d2..8c78ed9 100644 --- a/src/GUIStuff/Elements/DropDown.hpp +++ b/src/GUIStuff/Elements/DropDown.hpp @@ -1,11 +1,28 @@ +/* + * 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 . + */ + #pragma once #include "Element.hpp" #include "Helpers/ConvertVec.hpp" -#include "ManyElementScrollArea.hpp" #include "SelectableButton.hpp" #include "../ElementHelpers/LayoutHelpers.hpp" -#include "../ElementHelpers/TextLabelHelpers.hpp" #include "../ElementHelpers/ButtonHelpers.hpp" +#include "TextParagraph.hpp" #include "SVGIcon.hpp" namespace GUIStuff { @@ -38,15 +55,30 @@ template class DropDown : public Element { .innerContent = [&](const SelectableButton::InnerContentCallbackParameters&) { CLAY_AUTO_ID({ .layout = { - .sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0) }, + .sizing = { .width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0) }, .padding = {.left = 4, .right = 4}, .childGap = gui.io.theme->childGap1, .childAlignment = {.x = CLAY_ALIGN_X_LEFT, .y = CLAY_ALIGN_Y_CENTER}, .layoutDirection = CLAY_LEFT_TO_RIGHT, } }) { - text_label(gui, selections[static_cast(*data)]); - CLAY_AUTO_ID({.layout = {.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0)}}}) {} + RichText::TextData t; + t.paragraphs.emplace_back(); + t.paragraphs.back().text = selections[static_cast(*data)]; + gui.element("dropdown inner text area", [&](LayoutElement* l, const Clay_ElementId& lId) { + CLAY(lId, { + .layout = {.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0)}} + }) { + if(l->get_bb().has_value()) { + gui.element("dropdown inner text", TextParagraph::Data{ + .text = t, + .maxGrowX = l->get_bb().value().width(), + .maxGrowY = 0.0f, + .ellipsis = true + }); + } + } + }); CLAY_AUTO_ID({ .layout = { .sizing = {.width = CLAY_SIZING_FIT(ElementHelpers::SMALL_BUTTON_SIZE), .height = CLAY_SIZING_FIT(ElementHelpers::SMALL_BUTTON_SIZE)} @@ -59,59 +91,18 @@ template class DropDown : public Element { }); if(isOpen && boundingBox.has_value()) { - auto& buttonBB = boundingBox.value(); - float ENTRY_HEIGHT = buttonBB.height(); gui.set_z_index(gui.get_z_index() + 1, [&] { - gui.element("DROPDOWN", [&](LayoutElement* l, const Clay_ElementId& lId) { - float dropdownHeight = ENTRY_HEIGHT * selections.size() + DROPDOWN_OFFSET; - Clay_FloatingElementConfig floatConfig; - float maxHeight = gui.io.safeWindowRect.height(); - if(buttonBB.max.y() + dropdownHeight > gui.io.safeWindowRect.max.y()) { - float rightSideWidth = gui.io.safeWindowRect.max.x() - buttonBB.max.x(); - float leftSideWidth = buttonBB.min.x() - gui.io.safeWindowRect.min.x(); - if(rightSideWidth > buttonBB.width() || leftSideWidth > buttonBB.width()) - vertical_offset_setup(dropdownHeight, floatConfig, maxHeight, rightSideWidth >= leftSideWidth); - else { - if(gui.io.safeWindowRect.max.y() - buttonBB.max.y() >= buttonBB.min.y() - gui.io.safeWindowRect.min.y()) - bottom_offset_setup(dropdownHeight, floatConfig, maxHeight); - else - top_offset_setup(dropdownHeight, floatConfig, maxHeight); - } - } - else - bottom_offset_setup(dropdownHeight, floatConfig, maxHeight); - CLAY(lId, { - .layout = { - .sizing = {.width = CLAY_SIZING_FIXED(buttonBB.width()), .height = CLAY_SIZING_FIT(0, maxHeight)}, - .childGap = 0 - }, - .backgroundColor = convert_vec4(gui.io.theme->backColor1), - .cornerRadius = CLAY_CORNER_RADIUS(4), - .floating = floatConfig, - .border = { - .color = convert_vec4(gui.io.theme->fillColor2), - .width = CLAY_BORDER_OUTSIDE(1) - } - }) { - gui.element("dropdown scroll area", ManyElementScrollArea::Options{ - .entryHeight = ENTRY_HEIGHT, - .entryCount = selections.size(), - .clipHorizontal = true, - .elementContent = [&](size_t i) { - text_transparent_option_button("option", selections[i].c_str(), [&, i] { - *d = static_cast(i); - if(opts.onClick) opts.onClick(); - isOpen = false; - }); - } - }); - } - }, LayoutElement::Callbacks { - .onClick = [&](LayoutElement* l, const InputManager::MouseButtonCallbackArgs& m) { - if(!l->mouseHovering && !l->childMouseHovering && m.down && !dropdownButton->mouseHovering) { + dropdown_many_element_popup_layout(gui, "DROPDOWN", { + .button = this, + .isOpen = &isOpen, + .entrySize = boundingBox.value().dim(), + .entryCount = selections.size(), + .entryLayout = [&](size_t i) { + text_transparent_option_button("option", selections[i].c_str(), [&, i] { + *d = static_cast(i); + if(opts.onClick) opts.onClick(); isOpen = false; - gui.set_to_layout(); - } + }); } }); }); @@ -119,59 +110,6 @@ template class DropDown : public Element { } } private: - void bottom_offset_setup(float dropdownHeight, Clay_FloatingElementConfig& floatConfig, float& maxHeight) { - floatConfig = { - .offset = { - .y = DROPDOWN_OFFSET - }, - .zIndex = gui.get_z_index(), - .attachPoints = { - .element = CLAY_ATTACH_POINT_LEFT_TOP, - .parent = CLAY_ATTACH_POINT_LEFT_BOTTOM - }, - .attachTo = CLAY_ATTACH_TO_PARENT - }; - // This function might be used even when boundingBox isnt determined yet - maxHeight = boundingBox.has_value() ? std::max(gui.io.safeWindowRect.max.y() - boundingBox.value().max.y() - DROPDOWN_OFFSET, 0.0f) : 0.0f; - } - - void top_offset_setup(float dropdownHeight, Clay_FloatingElementConfig& floatConfig, float& maxHeight) { - floatConfig = { - .offset = { - .y = -DROPDOWN_OFFSET - }, - .zIndex = gui.get_z_index(), - .attachPoints = { - .element = CLAY_ATTACH_POINT_LEFT_BOTTOM, - .parent = CLAY_ATTACH_POINT_LEFT_TOP - }, - .attachTo = CLAY_ATTACH_TO_PARENT - }; - maxHeight = std::max(boundingBox.value().min.y() - gui.io.safeWindowRect.min.y() - DROPDOWN_OFFSET, 0.0f); - } - - void vertical_offset_setup(float dropdownHeight, Clay_FloatingElementConfig& floatConfig, float& maxHeight, bool isRightSide) { - auto& bb = boundingBox.value(); - float offsetY = bb.center().y() - dropdownHeight * 0.5f; - if(dropdownHeight >= gui.io.safeWindowRect.height() || offsetY < gui.io.safeWindowRect.min.y()) - offsetY = gui.io.safeWindowRect.min.y(); - else if(offsetY + dropdownHeight > gui.io.safeWindowRect.max.y()) - offsetY -= (offsetY + dropdownHeight) - gui.io.safeWindowRect.max.y(); - floatConfig = { - .offset = { - .x = isRightSide ? bb.max.x() + DROPDOWN_OFFSET : bb.min.x() - bb.width() - DROPDOWN_OFFSET, - .y = offsetY - }, - .zIndex = gui.get_z_index(), - .attachPoints = { - .element = CLAY_ATTACH_POINT_LEFT_TOP, - .parent = CLAY_ATTACH_POINT_LEFT_TOP - }, - .attachTo = CLAY_ATTACH_TO_ROOT - }; - maxHeight = gui.io.safeWindowRect.height(); - } - void text_transparent_option_button(const char* id, const char* text, const std::function& onClick) { using namespace ElementHelpers; text_button(gui, id, text, { diff --git a/src/GUIStuff/Elements/Element.cpp b/src/GUIStuff/Elements/Element.cpp index 73138aa..64232de 100644 --- a/src/GUIStuff/Elements/Element.cpp +++ b/src/GUIStuff/Elements/Element.cpp @@ -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 . + */ + #include "Element.hpp" #include "GUIStuffHelpers.hpp" @@ -9,6 +27,7 @@ namespace GUIStuff { void Element::deselect() {} void Element::input_paste_callback(const CustomEvents::PasteEvent& paste) { } + void Element::input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput) { } void Element::input_text_key_callback(const InputManager::KeyCallbackArgs& key) { } void Element::input_text_callback(const InputManager::TextCallbackArgs& text) { } void Element::input_mouse_button_callback(const InputManager::MouseButtonCallbackArgs& button) { } diff --git a/src/GUIStuff/Elements/Element.hpp b/src/GUIStuff/Elements/Element.hpp index b62a477..9cf1aff 100644 --- a/src/GUIStuff/Elements/Element.hpp +++ b/src/GUIStuff/Elements/Element.hpp @@ -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 . + */ + #pragma once #include "GUIStuffHelpers.hpp" @@ -27,6 +45,7 @@ namespace GUIStuff { virtual void deselect(); 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_mouse_button_callback(const InputManager::MouseButtonCallbackArgs& button); diff --git a/src/GUIStuff/Elements/FontPicker.cpp b/src/GUIStuff/Elements/FontPicker.cpp index 4b6ce88..550559b 100644 --- a/src/GUIStuff/Elements/FontPicker.cpp +++ b/src/GUIStuff/Elements/FontPicker.cpp @@ -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 . + */ + #include "FontPicker.hpp" #include "Helpers/ConvertVec.hpp" #include @@ -14,18 +32,12 @@ #include "TextParagraph.hpp" #include "ManyElementScrollArea.hpp" -std::vector sortedFontList; -std::vector sortedFontListLowercase; - namespace GUIStuff { -FontPicker::FontPicker(GUIManager& gui): Element(gui) {} - -void FontPicker::layout(const Clay_ElementId& id, std::string* newFontName, const FontPickerData& newData) { - using namespace ElementHelpers; - fontName = newFontName; - data = newData; +std::vector sortedFontListLowercase; +std::vector sortedFontList; +const std::vector& FontPicker::sorted_font_list(GUIManager& gui) { if(sortedFontList.empty()) { auto icu = SkUnicodes::ICU::Make(); std::set sortedFontSet; @@ -53,6 +65,17 @@ void FontPicker::layout(const Clay_ElementId& id, std::string* newFontName, cons for(std::string& s : sortedFontListLowercase) std::transform(s.begin(), s.end(), s.begin(), ::tolower); } + return sortedFontList; +} + +FontPicker::FontPicker(GUIManager& gui): Element(gui) {} + +void FontPicker::layout(const Clay_ElementId& id, std::string* newFontName, const FontPickerData& newData) { + using namespace ElementHelpers; + fontName = newFontName; + data = newData; + + sorted_font_list(gui); auto sortedFontListValIt = std::find(sortedFontList.begin(), sortedFontList.end(), *fontName); size_t val = sortedFontListValIt != sortedFontList.end() ? sortedFontListValIt - sortedFontList.begin() : std::numeric_limits::max(); diff --git a/src/GUIStuff/Elements/FontPicker.hpp b/src/GUIStuff/Elements/FontPicker.hpp index 020517e..30779e8 100644 --- a/src/GUIStuff/Elements/FontPicker.hpp +++ b/src/GUIStuff/Elements/FontPicker.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" #include @@ -12,6 +30,7 @@ class FontPicker : public Element { public: FontPicker(GUIManager& gui); void layout(const Clay_ElementId& id, std::string* newFontName, const FontPickerData& newData = {}); + static const std::vector& sorted_font_list(GUIManager& gui); private: std::string* fontName; FontPickerData data; diff --git a/src/GUIStuff/Elements/GUIStuffHelpers.cpp b/src/GUIStuff/Elements/GUIStuffHelpers.cpp index 202fe01..a3e48d0 100644 --- a/src/GUIStuff/Elements/GUIStuffHelpers.cpp +++ b/src/GUIStuff/Elements/GUIStuffHelpers.cpp @@ -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 . + */ + #include "Element.hpp" #include "Helpers/MathExtras.hpp" #include diff --git a/src/GUIStuff/Elements/GUIStuffHelpers.hpp b/src/GUIStuff/Elements/GUIStuffHelpers.hpp index f5b7e3e..027b4b2 100644 --- a/src/GUIStuff/Elements/GUIStuffHelpers.hpp +++ b/src/GUIStuff/Elements/GUIStuffHelpers.hpp @@ -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 . + */ + #pragma once #include "Helpers/ConvertVec.hpp" #include diff --git a/src/GUIStuff/Elements/GridScrollArea.cpp b/src/GUIStuff/Elements/GridScrollArea.cpp index c0b8b2f..1b7e5c2 100644 --- a/src/GUIStuff/Elements/GridScrollArea.cpp +++ b/src/GUIStuff/Elements/GridScrollArea.cpp @@ -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 . + */ + #include "GridScrollArea.hpp" #include "Helpers/ConvertVec.hpp" #include "../GUIManager.hpp" diff --git a/src/GUIStuff/Elements/GridScrollArea.hpp b/src/GUIStuff/Elements/GridScrollArea.hpp index 9da39ad..448d9e2 100644 --- a/src/GUIStuff/Elements/GridScrollArea.hpp +++ b/src/GUIStuff/Elements/GridScrollArea.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" #include "Helpers/ConvertVec.hpp" diff --git a/src/GUIStuff/Elements/HueVerticalSlider.cpp b/src/GUIStuff/Elements/HueVerticalSlider.cpp index ef12e02..d49fc6e 100644 --- a/src/GUIStuff/Elements/HueVerticalSlider.cpp +++ b/src/GUIStuff/Elements/HueVerticalSlider.cpp @@ -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 . + */ + #include "HueVerticalSlider.hpp" #include "../GUIManager.hpp" #include "ColorPicker.hpp" diff --git a/src/GUIStuff/Elements/HueVerticalSlider.hpp b/src/GUIStuff/Elements/HueVerticalSlider.hpp index 0458686..66447a5 100644 --- a/src/GUIStuff/Elements/HueVerticalSlider.hpp +++ b/src/GUIStuff/Elements/HueVerticalSlider.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" diff --git a/src/GUIStuff/Elements/ImageDisplay.cpp b/src/GUIStuff/Elements/ImageDisplay.cpp index 1bcb8a2..8682f98 100644 --- a/src/GUIStuff/Elements/ImageDisplay.cpp +++ b/src/GUIStuff/Elements/ImageDisplay.cpp @@ -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 . + */ + #include "ImageDisplay.hpp" #include "../GUIManager.hpp" #include diff --git a/src/GUIStuff/Elements/ImageDisplay.hpp b/src/GUIStuff/Elements/ImageDisplay.hpp index e66e150..5a2bcde 100644 --- a/src/GUIStuff/Elements/ImageDisplay.hpp +++ b/src/GUIStuff/Elements/ImageDisplay.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" diff --git a/src/GUIStuff/Elements/LayoutElement.cpp b/src/GUIStuff/Elements/LayoutElement.cpp index a4852d4..e6354d9 100644 --- a/src/GUIStuff/Elements/LayoutElement.cpp +++ b/src/GUIStuff/Elements/LayoutElement.cpp @@ -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 . + */ + #include "LayoutElement.hpp" #include "Helpers/ConvertVec.hpp" #include "../GUIManager.hpp" diff --git a/src/GUIStuff/Elements/LayoutElement.hpp b/src/GUIStuff/Elements/LayoutElement.hpp index a9b8798..8a29a51 100644 --- a/src/GUIStuff/Elements/LayoutElement.hpp +++ b/src/GUIStuff/Elements/LayoutElement.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" diff --git a/src/GUIStuff/Elements/ManyElementScrollArea.cpp b/src/GUIStuff/Elements/ManyElementScrollArea.cpp index 95a71d0..e1df34a 100644 --- a/src/GUIStuff/Elements/ManyElementScrollArea.cpp +++ b/src/GUIStuff/Elements/ManyElementScrollArea.cpp @@ -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 . + */ + #include "ManyElementScrollArea.hpp" #include "../GUIManager.hpp" diff --git a/src/GUIStuff/Elements/ManyElementScrollArea.hpp b/src/GUIStuff/Elements/ManyElementScrollArea.hpp index d850c86..e313466 100644 --- a/src/GUIStuff/Elements/ManyElementScrollArea.hpp +++ b/src/GUIStuff/Elements/ManyElementScrollArea.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" #include "Helpers/ConvertVec.hpp" diff --git a/src/GUIStuff/Elements/MovableTabList.cpp b/src/GUIStuff/Elements/MovableTabList.cpp index 186c352..f4b8161 100644 --- a/src/GUIStuff/Elements/MovableTabList.cpp +++ b/src/GUIStuff/Elements/MovableTabList.cpp @@ -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 . + */ + #include "MovableTabList.hpp" #include "Helpers/ConvertVec.hpp" #include "../GUIManager.hpp" diff --git a/src/GUIStuff/Elements/MovableTabList.hpp b/src/GUIStuff/Elements/MovableTabList.hpp index aae4673..7013457 100644 --- a/src/GUIStuff/Elements/MovableTabList.hpp +++ b/src/GUIStuff/Elements/MovableTabList.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" #include "SelectableButton.hpp" diff --git a/src/GUIStuff/Elements/MutableTextLabel.cpp b/src/GUIStuff/Elements/MutableTextLabel.cpp index 54b27cb..543c0d0 100644 --- a/src/GUIStuff/Elements/MutableTextLabel.cpp +++ b/src/GUIStuff/Elements/MutableTextLabel.cpp @@ -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 . + */ + #include "MutableTextLabel.hpp" #include "../GUIManager.hpp" diff --git a/src/GUIStuff/Elements/MutableTextLabel.hpp b/src/GUIStuff/Elements/MutableTextLabel.hpp index bd13408..d7ff7e6 100644 --- a/src/GUIStuff/Elements/MutableTextLabel.hpp +++ b/src/GUIStuff/Elements/MutableTextLabel.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" #include "Helpers/ConvertVec.hpp" diff --git a/src/GUIStuff/Elements/NumberSlider.hpp b/src/GUIStuff/Elements/NumberSlider.hpp index 9d9ed90..58554e1 100644 --- a/src/GUIStuff/Elements/NumberSlider.hpp +++ b/src/GUIStuff/Elements/NumberSlider.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" #include "../GUIManager.hpp" diff --git a/src/GUIStuff/Elements/PaintCircleMenu.cpp b/src/GUIStuff/Elements/PaintCircleMenu.cpp index 6e08336..1c59269 100644 --- a/src/GUIStuff/Elements/PaintCircleMenu.cpp +++ b/src/GUIStuff/Elements/PaintCircleMenu.cpp @@ -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 . + */ + #include "PaintCircleMenu.hpp" #include "Helpers/ConvertVec.hpp" #include diff --git a/src/GUIStuff/Elements/PaintCircleMenu.hpp b/src/GUIStuff/Elements/PaintCircleMenu.hpp index d1d2671..3bd1257 100644 --- a/src/GUIStuff/Elements/PaintCircleMenu.hpp +++ b/src/GUIStuff/Elements/PaintCircleMenu.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" diff --git a/src/GUIStuff/Elements/PositionAdjustingPopupMenu.cpp b/src/GUIStuff/Elements/PositionAdjustingPopupMenu.cpp index 56cf994..56f7b7c 100644 --- a/src/GUIStuff/Elements/PositionAdjustingPopupMenu.cpp +++ b/src/GUIStuff/Elements/PositionAdjustingPopupMenu.cpp @@ -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 . + */ + #include "PositionAdjustingPopupMenu.hpp" #include "../GUIManager.hpp" #include "Helpers/ConvertVec.hpp" diff --git a/src/GUIStuff/Elements/PositionAdjustingPopupMenu.hpp b/src/GUIStuff/Elements/PositionAdjustingPopupMenu.hpp index 8f7d9e2..80e4038 100644 --- a/src/GUIStuff/Elements/PositionAdjustingPopupMenu.hpp +++ b/src/GUIStuff/Elements/PositionAdjustingPopupMenu.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" #include "LayoutElement.hpp" diff --git a/src/GUIStuff/Elements/RadioButton.cpp b/src/GUIStuff/Elements/RadioButton.cpp index 1de0a80..fa5ed3e 100644 --- a/src/GUIStuff/Elements/RadioButton.cpp +++ b/src/GUIStuff/Elements/RadioButton.cpp @@ -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 . + */ + #include "RadioButton.hpp" #include "../GUIManager.hpp" #include "../../TimePoint.hpp" diff --git a/src/GUIStuff/Elements/RadioButton.hpp b/src/GUIStuff/Elements/RadioButton.hpp index cabfd4f..fcd2018 100644 --- a/src/GUIStuff/Elements/RadioButton.hpp +++ b/src/GUIStuff/Elements/RadioButton.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" diff --git a/src/GUIStuff/Elements/RotateWheel.cpp b/src/GUIStuff/Elements/RotateWheel.cpp index 0151c73..d42ae39 100644 --- a/src/GUIStuff/Elements/RotateWheel.cpp +++ b/src/GUIStuff/Elements/RotateWheel.cpp @@ -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 . + */ + #include "RotateWheel.hpp" #include "Helpers/ConvertVec.hpp" #include "../GUIManager.hpp" diff --git a/src/GUIStuff/Elements/RotateWheel.hpp b/src/GUIStuff/Elements/RotateWheel.hpp index f2aaf9e..d512066 100644 --- a/src/GUIStuff/Elements/RotateWheel.hpp +++ b/src/GUIStuff/Elements/RotateWheel.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" diff --git a/src/GUIStuff/Elements/SVGIcon.cpp b/src/GUIStuff/Elements/SVGIcon.cpp index 051d87c..3845469 100644 --- a/src/GUIStuff/Elements/SVGIcon.cpp +++ b/src/GUIStuff/Elements/SVGIcon.cpp @@ -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 . + */ + #include "SVGIcon.hpp" #include "Helpers/ConvertVec.hpp" #include diff --git a/src/GUIStuff/Elements/SVGIcon.hpp b/src/GUIStuff/Elements/SVGIcon.hpp index 3beb4fb..8480170 100644 --- a/src/GUIStuff/Elements/SVGIcon.hpp +++ b/src/GUIStuff/Elements/SVGIcon.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" diff --git a/src/GUIStuff/Elements/SaturationValueSquare.cpp b/src/GUIStuff/Elements/SaturationValueSquare.cpp index e14876b..2605e6c 100644 --- a/src/GUIStuff/Elements/SaturationValueSquare.cpp +++ b/src/GUIStuff/Elements/SaturationValueSquare.cpp @@ -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 . + */ + #include "SaturationValueSquare.hpp" #include "../GUIManager.hpp" #include "ColorPicker.hpp" diff --git a/src/GUIStuff/Elements/SaturationValueSquare.hpp b/src/GUIStuff/Elements/SaturationValueSquare.hpp index d9e0538..5fb220e 100644 --- a/src/GUIStuff/Elements/SaturationValueSquare.hpp +++ b/src/GUIStuff/Elements/SaturationValueSquare.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" diff --git a/src/GUIStuff/Elements/ScrollArea.cpp b/src/GUIStuff/Elements/ScrollArea.cpp index d4812e1..40aa97e 100644 --- a/src/GUIStuff/Elements/ScrollArea.cpp +++ b/src/GUIStuff/Elements/ScrollArea.cpp @@ -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 . + */ + #include "ScrollArea.hpp" #include "../GUIManager.hpp" #include diff --git a/src/GUIStuff/Elements/ScrollArea.hpp b/src/GUIStuff/Elements/ScrollArea.hpp index 30c8968..9395d08 100644 --- a/src/GUIStuff/Elements/ScrollArea.hpp +++ b/src/GUIStuff/Elements/ScrollArea.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" #include "Helpers/ConvertVec.hpp" diff --git a/src/GUIStuff/Elements/SelectableButton.cpp b/src/GUIStuff/Elements/SelectableButton.cpp index 49030e2..7c7914f 100644 --- a/src/GUIStuff/Elements/SelectableButton.cpp +++ b/src/GUIStuff/Elements/SelectableButton.cpp @@ -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 . + */ + #include "SelectableButton.hpp" #include "Helpers/ConvertVec.hpp" #include "../GUIManager.hpp" diff --git a/src/GUIStuff/Elements/SelectableButton.hpp b/src/GUIStuff/Elements/SelectableButton.hpp index 1cd6921..25ea927 100644 --- a/src/GUIStuff/Elements/SelectableButton.hpp +++ b/src/GUIStuff/Elements/SelectableButton.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" diff --git a/src/GUIStuff/Elements/TextBox.decl.hpp b/src/GUIStuff/Elements/TextBox.decl.hpp index cb20436..06a7301 100644 --- a/src/GUIStuff/Elements/TextBox.decl.hpp +++ b/src/GUIStuff/Elements/TextBox.decl.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" #include "../../RichText/TextBox.hpp" @@ -33,10 +51,13 @@ template class TextBox : public Element { virtual void deselect() override; virtual void clay_draw(SkCanvas* canvas, UpdateInputData& io, Clay_RenderCommand* command, bool skiaAA) 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_callback(const InputManager::MouseButtonCallbackArgs& button) override; virtual void input_mouse_motion_callback(const InputManager::MouseMotionCallbackArgs& motion) override; + virtual void input_finger_touch_callback(const InputManager::FingerTouchCallbackArgs& touch) override; + virtual void input_finger_motion_callback(const InputManager::FingerMotionCallbackArgs& motion) override; virtual std::optional get_text_box_start_info() override; ~TextBox(); private: diff --git a/src/GUIStuff/Elements/TextBox.hpp b/src/GUIStuff/Elements/TextBox.hpp index 45d390a..8a1031e 100644 --- a/src/GUIStuff/Elements/TextBox.hpp +++ b/src/GUIStuff/Elements/TextBox.hpp @@ -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 . + */ + #pragma once #include "TextBox.decl.hpp" #include "TextBox.impl.hpp" diff --git a/src/GUIStuff/Elements/TextBox.impl.hpp b/src/GUIStuff/Elements/TextBox.impl.hpp index f623355..1ec1ef9 100644 --- a/src/GUIStuff/Elements/TextBox.impl.hpp +++ b/src/GUIStuff/Elements/TextBox.impl.hpp @@ -1,6 +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 . + */ + #include "TextBox.decl.hpp" #include "../GUIManager.hpp" #include +#include +#include "../../AndroidJNICalls.hpp" namespace GUIStuff { @@ -84,7 +104,8 @@ template void TextBox::select() { if(!is_selected()) { if(isEmptyText) textbox->clear_text(); - edit = std::make_unique(gui.io.input->text_box_get_new_id(), textbox, cur, nullptr); + edit = std::make_unique(CustomEvents::text_box_get_new_id(), textbox, cur, nullptr); + Logger::get().log("INFO", "Select"); CustomEvents::emit_event(CustomEvents::RefreshTextBoxInputEvent{}); } } @@ -93,6 +114,7 @@ template void TextBox::deselect() { if(is_selected()) { edit = nullptr; if(userInfo.onDeselect) userInfo.onDeselect(); + Logger::get().log("INFO", "Deselect"); CustomEvents::emit_event(CustomEvents::RefreshTextBoxInputEvent{}); reset_textbox_text(); populate_empty_textbox(); @@ -108,6 +130,11 @@ template void TextBox::input_paste_callback(const CustomEvents:: after_text_input_callback(); } +template void TextBox::input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput) { + if(is_selected() && edit->input_android_text_box_input_callback(textboxInput).textEdited) + after_text_input_callback(); +} + template void TextBox::input_text_key_callback(const InputManager::KeyCallbackArgs& key) { if(is_selected()) { if(key.key == InputManager::KEY_GENERIC_ENTER && key.down) { @@ -116,6 +143,7 @@ template void TextBox::input_text_key_callback(const InputManage if(success && userInfo.onEdit) userInfo.onEdit(); if(userInfo.onEnter) userInfo.onEnter(); reset_textbox_text(); + if(is_selected()) edit->android_force_update_textbox_and_cursor(); }); } else { @@ -166,20 +194,53 @@ template void TextBox::input_mouse_button_callback(const InputMa if(userInfo.onSelect) userInfo.onSelect(); }); } - textbox->process_mouse_left_button(*cur, button.pos - boundingBox.value().min, button.clicks, true, gui.io.input->key(InputManager::KEY_GENERIC_LSHIFT).held); + isHeld = true; + edit->process_mouse_left_button(button.pos - boundingBox.value().min, button.clicks, isHeld, gui.io.input->key(InputManager::KEY_GENERIC_LSHIFT).held); } - else if(is_selected()) + else if(is_selected()) { + isHeld = false; deselect(); + } } else { - textbox->process_mouse_left_button(*cur, button.pos - boundingBox.value().min, 0, false, gui.io.input->key(InputManager::KEY_GENERIC_LSHIFT).held); + isHeld = false; + if(is_selected()) + edit->process_mouse_left_button(button.pos - boundingBox.value().min, 0, isHeld, gui.io.input->key(InputManager::KEY_GENERIC_LSHIFT).held); } } } template void TextBox::input_mouse_motion_callback(const InputManager::MouseMotionCallbackArgs& motion) { - if(boundingBox.has_value()) - textbox->process_mouse_left_button(*cur, motion.pos - boundingBox.value().min, 0, isHeld, gui.io.input->key(InputManager::KEY_GENERIC_LSHIFT).held); + if(boundingBox.has_value() && is_selected()) + edit->process_mouse_left_button(motion.pos - boundingBox.value().min, 0, isHeld, gui.io.input->key(InputManager::KEY_GENERIC_LSHIFT).held); +} + +template void TextBox::input_finger_touch_callback(const InputManager::FingerTouchCallbackArgs& touch) { + if(boundingBox.has_value()) { + if(touch.down) { + if(mouseHovering) { + if(!is_selected()) { + select(); + gui.set_post_callback_func_high_priority([&] { + if(userInfo.onSelect) userInfo.onSelect(); + }); + } + isHeld = true; + edit->input_finger_touch_down(touch.pos - boundingBox.value().min); + } + else if(is_selected()) { + isHeld = false; + deselect(); + } + } + else + isHeld = false; + } +} + +template void TextBox::input_finger_motion_callback(const InputManager::FingerMotionCallbackArgs& motion) { + if(boundingBox.has_value() && is_selected() && isHeld) + edit->input_finger_held_motion(motion.pos - boundingBox.value().min); } template std::optional TextBox::get_text_box_start_info() { @@ -188,7 +249,9 @@ template std::optional TextBox:: return InputManager::TextBoxStartInfo{ .id = edit->id, .rect = rect, - .inputProperties = userInfo.textInputProps + .inputProperties = userInfo.textInputProps, + .textBox = textbox, + .cursor = cur }; } return std::nullopt; @@ -224,8 +287,10 @@ template bool TextBox::update_data() { } template TextBox::~TextBox() { - if(is_selected()) + if(is_selected()) { + Logger::get().log("INFO", "Destroy"); CustomEvents::emit_event(CustomEvents::RefreshTextBoxInputEvent{}); + } } } diff --git a/src/GUIStuff/Elements/TextParagraph.cpp b/src/GUIStuff/Elements/TextParagraph.cpp index 1c91929..3b978a6 100644 --- a/src/GUIStuff/Elements/TextParagraph.cpp +++ b/src/GUIStuff/Elements/TextParagraph.cpp @@ -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 . + */ + #include "TextParagraph.hpp" #include #include diff --git a/src/GUIStuff/Elements/TextParagraph.hpp b/src/GUIStuff/Elements/TextParagraph.hpp index 8cb81ce..5cd7a18 100644 --- a/src/GUIStuff/Elements/TextParagraph.hpp +++ b/src/GUIStuff/Elements/TextParagraph.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" #include "../../RichText/TextBox.hpp" diff --git a/src/GUIStuff/Elements/TreeListing.cpp b/src/GUIStuff/Elements/TreeListing.cpp index 55d2793..bf8709c 100644 --- a/src/GUIStuff/Elements/TreeListing.cpp +++ b/src/GUIStuff/Elements/TreeListing.cpp @@ -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 . + */ + #include "TreeListing.hpp" #include "Helpers/ConvertVec.hpp" #include "ManyElementScrollArea.hpp" diff --git a/src/GUIStuff/Elements/TreeListing.hpp b/src/GUIStuff/Elements/TreeListing.hpp index 52e4f86..5bee358 100644 --- a/src/GUIStuff/Elements/TreeListing.hpp +++ b/src/GUIStuff/Elements/TreeListing.hpp @@ -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 . + */ + #pragma once #include "Element.hpp" #include diff --git a/src/GUIStuff/GUIFloatAnimation.cpp b/src/GUIStuff/GUIFloatAnimation.cpp index 60f2ec2..1d14a18 100644 --- a/src/GUIStuff/GUIFloatAnimation.cpp +++ b/src/GUIStuff/GUIFloatAnimation.cpp @@ -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 . + */ + #include "GUIFloatAnimation.hpp" #include "GUIManager.hpp" diff --git a/src/GUIStuff/GUIFloatAnimation.hpp b/src/GUIStuff/GUIFloatAnimation.hpp index 68a9cab..6619cd1 100644 --- a/src/GUIStuff/GUIFloatAnimation.hpp +++ b/src/GUIStuff/GUIFloatAnimation.hpp @@ -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 . + */ + #pragma once #include diff --git a/src/GUIStuff/GUIManager.cpp b/src/GUIStuff/GUIManager.cpp index 910d557..fae87ff 100644 --- a/src/GUIStuff/GUIManager.cpp +++ b/src/GUIStuff/GUIManager.cpp @@ -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 . + */ + #include "GUIManager.hpp" #include #include @@ -707,6 +725,11 @@ void GUIManager::input_paste_callback(const CustomEvents::PasteEvent& paste) { e->elem->input_paste_callback(paste); } +void GUIManager::input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput) { + for(ElementContainer* e : orderedElements) + e->elem->input_android_text_box_input_callback(textboxInput); +} + void GUIManager::input_text_key_callback(const InputManager::KeyCallbackArgs& key) { for(ElementContainer* e : orderedElements) e->elem->input_text_key_callback(key); diff --git a/src/GUIStuff/GUIManager.hpp b/src/GUIStuff/GUIManager.hpp index 2d13c23..5de86d9 100644 --- a/src/GUIStuff/GUIManager.hpp +++ b/src/GUIStuff/GUIManager.hpp @@ -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 . + */ + #pragma once #include #include @@ -100,6 +118,7 @@ class GUIManager { DefaultStringArena strArena; void input_paste_callback(const CustomEvents::PasteEvent& paste); + void input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput); void input_text_key_callback(const InputManager::KeyCallbackArgs& key); void input_text_callback(const InputManager::TextCallbackArgs& text); void input_key_callback(const InputManager::KeyCallbackArgs& key); diff --git a/src/GUIStuff/GUIManagerID.cpp b/src/GUIStuff/GUIManagerID.cpp index 9227019..8a5002d 100644 --- a/src/GUIStuff/GUIManagerID.cpp +++ b/src/GUIStuff/GUIManagerID.cpp @@ -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 . + */ + #include "GUIManagerID.hpp" namespace GUIStuff { diff --git a/src/GUIStuff/GUIManagerID.hpp b/src/GUIStuff/GUIManagerID.hpp index 5b32063..82586e1 100644 --- a/src/GUIStuff/GUIManagerID.hpp +++ b/src/GUIStuff/GUIManagerID.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/src/GlobalConfig.cpp b/src/GlobalConfig.cpp index 2fc6fab..2fbb5f5 100644 --- a/src/GlobalConfig.cpp +++ b/src/GlobalConfig.cpp @@ -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 . + */ + #include "GlobalConfig.hpp" #include #include "Helpers/StringHelpers.hpp" @@ -185,14 +203,698 @@ void GlobalConfig::load_licenses() { ownLicenseText = "InfiniPaint v" + VersionConstants::CURRENT_VERSION_STRING; ownLicenseText += R"( +Copyright (C) 2025-2026 Yousef Khadadeh -Copyright © 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. -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +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. -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +GPLv3 License text: + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. )"; } diff --git a/src/GlobalConfig.hpp b/src/GlobalConfig.hpp index 15a7991..f4957db 100644 --- a/src/GlobalConfig.hpp +++ b/src/GlobalConfig.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/src/GridManager.cpp b/src/GridManager.cpp index e3f3952..3b92f6b 100644 --- a/src/GridManager.cpp +++ b/src/GridManager.cpp @@ -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 . + */ + #include "GridManager.hpp" #include "World.hpp" #include "MainProgram.hpp" diff --git a/src/GridManager.hpp b/src/GridManager.hpp index 71f6dfe..6b0d695 100644 --- a/src/GridManager.hpp +++ b/src/GridManager.hpp @@ -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 . + */ + #pragma once #include "WorldGrid.hpp" #include "cereal/archives/portable_binary.hpp" diff --git a/src/InputManager.cpp b/src/InputManager.cpp index c36ea62..f5124f7 100644 --- a/src/InputManager.cpp +++ b/src/InputManager.cpp @@ -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 . + */ + #include "InputManager.hpp" #include "CustomEvents.hpp" @@ -91,12 +109,6 @@ InputManager::InputManager(MainProgram& initMain): keyAssignments = defaultKeyAssignments; } -InputManager::TextBoxID InputManager::text_box_get_new_id() { - static TextBoxID nextID = 0; - ++nextID; - return nextID; -} - void InputManager::refresh_receiving_text_box_input() { std::optional startInfo = main.get_text_box_start_info(); if(startInfo.has_value()) { @@ -115,7 +127,7 @@ void InputManager::refresh_receiving_text_box_input() { update_textbox_rectangle(currentTextboxID.value(), startInfo->rect); #ifdef __ANDROID__ - AndroidJNICalls::startTextInput(startInfo->inputProperties.androidInputType); + AndroidJNICalls::startTextInput(startInfo->id, startInfo->textBox, startInfo->cursor, startInfo->modMap, startInfo->inputProperties.androidInputType); #else SDL_StartTextInputWithProperties(main.window.sdlWindow, propIDVal); #endif @@ -125,9 +137,9 @@ void InputManager::refresh_receiving_text_box_input() { #endif } else { - SDL_StopTextInput(main.window.sdlWindow); - currentTextboxID = std::nullopt; excludeIMEFromSafeArea = false; + currentTextboxID = std::nullopt; + SDL_StopTextInput(main.window.sdlWindow); screenOffset = {0.0f, 0.0f}; #ifdef __EMSCRIPTEN__ isAcceptingInputEmscripten = 0; @@ -139,7 +151,7 @@ bool InputManager::text_is_accepting_input() { return currentTextboxID.has_value(); } -void InputManager::update_textbox_rectangle(TextBoxID textboxID, std::optional> textboxRect) { +void InputManager::update_textbox_rectangle(CustomEvents::InputTextBoxID textboxID, std::optional> textboxRect) { if(currentTextboxID.has_value() && textboxID == currentTextboxID.value()) { excludeIMEFromSafeArea = !textboxRect.has_value(); if(excludeIMEFromSafeArea) @@ -855,7 +867,7 @@ void InputManager::update_safe_area() { main.window.safeArea = SCollision::AABB({0, 0}, {main.window.size.x(), main.window.size.y()}); std::scoped_lock a{safeAreaWithoutIMEMutex}; - if(excludeIMEFromSafeArea && safeAreaWithoutIME.has_value()) + if(safeAreaWithoutIME.has_value() && excludeIMEFromSafeArea) main.window.safeArea = safeAreaWithoutIME.value(); } diff --git a/src/InputManager.hpp b/src/InputManager.hpp index faea74d..7dfaed3 100644 --- a/src/InputManager.hpp +++ b/src/InputManager.hpp @@ -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 . + */ + #pragma once #include #include @@ -143,7 +161,6 @@ struct InputManager { ANDROIDTEXT_TYPE_TEXT_VARIATION_WEB_PASSWORD = 0x000000e0 }; - typedef int64_t TextBoxID; struct TextInputProperties { SDL_TextInputType inputType; SDL_Capitalization capitalization; @@ -153,25 +170,24 @@ struct InputManager { }; struct TextBoxStartInfo { - TextBoxID id; + CustomEvents::InputTextBoxID id; std::optional> rect; TextInputProperties inputProperties; // Android textbox info - std::string str; - int startCursorPos; - int endCursorPos; + std::shared_ptr textBox; + std::shared_ptr cursor; + std::shared_ptr modMap; }; void refresh_receiving_text_box_input(); - void update_textbox_rectangle(TextBoxID textboxID, std::optional> textboxRect); + void update_textbox_rectangle(CustomEvents::InputTextBoxID textboxID, std::optional> textboxRect); bool text_is_accepting_input(); void text_update_textbox_rectangle(); - TextBoxID text_box_get_new_id(); void update_text_box_area_offset(); - std::optional currentTextboxID; + std::optional currentTextboxID; std::optional textPropID; #ifdef __APPLE__ @@ -413,7 +429,7 @@ struct InputManager { std::mutex safeAreaWithoutIMEMutex; std::optional> safeAreaWithoutIME; - bool excludeIMEFromSafeArea = false; + std::atomic excludeIMEFromSafeArea = false; Vector2f screenOffset = {0.0f, 0.0f}; MainProgram& main; diff --git a/src/MainProgram.cpp b/src/MainProgram.cpp index 1a6fbda..ba0c0b2 100755 --- a/src/MainProgram.cpp +++ b/src/MainProgram.cpp @@ -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 . + */ + #include "MainProgram.hpp" #include "CustomEvents.hpp" #include "VersionConstants.hpp" @@ -292,6 +310,12 @@ void MainProgram::input_paste_callback(const CustomEvents::PasteEvent& paste) { post_callback(); } +void MainProgram::input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput) { + g.input_android_text_box_input_callback(textboxInput); + screen->input_android_text_box_input_callback(textboxInput); + post_callback(); +} + void MainProgram::input_global_back_button_callback() { screen->input_global_back_button_callback(); post_callback(); diff --git a/src/MainProgram.hpp b/src/MainProgram.hpp index fb5f346..f50d8f2 100644 --- a/src/MainProgram.hpp +++ b/src/MainProgram.hpp @@ -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 . + */ + #pragma once #include "CustomEvents.hpp" #include "DrawData.hpp" @@ -135,6 +153,7 @@ class MainProgram { void input_add_file_to_canvas_callback(const CustomEvents::AddFileToCanvasEvent& addFile); void input_open_infinipaint_file_callback(const CustomEvents::OpenInfiniPaintFileEvent& openFile); void input_paste_callback(const CustomEvents::PasteEvent& paste); + void input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput); void input_app_about_to_go_to_background_callback(); void input_global_back_button_callback(); diff --git a/src/ResourceDisplay/FileResourceDisplay.cpp b/src/ResourceDisplay/FileResourceDisplay.cpp index 1e138ba..12a6e41 100644 --- a/src/ResourceDisplay/FileResourceDisplay.cpp +++ b/src/ResourceDisplay/FileResourceDisplay.cpp @@ -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 . + */ + #include "FileResourceDisplay.hpp" #include "../FontData.hpp" #include "../GUIStuff/Elements/Element.hpp" diff --git a/src/ResourceDisplay/FileResourceDisplay.hpp b/src/ResourceDisplay/FileResourceDisplay.hpp index 7d1f064..614f546 100644 --- a/src/ResourceDisplay/FileResourceDisplay.hpp +++ b/src/ResourceDisplay/FileResourceDisplay.hpp @@ -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 . + */ + #pragma once #include "ResourceDisplay.hpp" #include diff --git a/src/ResourceDisplay/ImageResourceDisplay.cpp b/src/ResourceDisplay/ImageResourceDisplay.cpp index db277e6..356fd8d 100644 --- a/src/ResourceDisplay/ImageResourceDisplay.cpp +++ b/src/ResourceDisplay/ImageResourceDisplay.cpp @@ -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 . + */ + #include "ImageResourceDisplay.hpp" #include #include diff --git a/src/ResourceDisplay/ImageResourceDisplay.hpp b/src/ResourceDisplay/ImageResourceDisplay.hpp index 240cf22..0a23a6c 100644 --- a/src/ResourceDisplay/ImageResourceDisplay.hpp +++ b/src/ResourceDisplay/ImageResourceDisplay.hpp @@ -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 . + */ + #pragma once #include "ResourceDisplay.hpp" #include diff --git a/src/ResourceDisplay/ResourceDisplay.cpp b/src/ResourceDisplay/ResourceDisplay.cpp index 4affc1e..615b7bb 100644 --- a/src/ResourceDisplay/ResourceDisplay.cpp +++ b/src/ResourceDisplay/ResourceDisplay.cpp @@ -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 . + */ + #include "ResourceDisplay.hpp" void ResourceDisplay::camera_view_update(const CoordSpaceHelper& compCoords, const SCollision::AABB& compAABB, const DrawData& drawData, const SkRect& imRect) { diff --git a/src/ResourceDisplay/ResourceDisplay.hpp b/src/ResourceDisplay/ResourceDisplay.hpp index b92b59b..1e3a099 100644 --- a/src/ResourceDisplay/ResourceDisplay.hpp +++ b/src/ResourceDisplay/ResourceDisplay.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/src/ResourceDisplay/SvgResourceDisplay.cpp b/src/ResourceDisplay/SvgResourceDisplay.cpp index e1d86b0..572f473 100644 --- a/src/ResourceDisplay/SvgResourceDisplay.cpp +++ b/src/ResourceDisplay/SvgResourceDisplay.cpp @@ -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 . + */ + #include "SvgResourceDisplay.hpp" #include "../MainProgram.hpp" #include diff --git a/src/ResourceDisplay/SvgResourceDisplay.hpp b/src/ResourceDisplay/SvgResourceDisplay.hpp index 6014618..29aab3b 100644 --- a/src/ResourceDisplay/SvgResourceDisplay.hpp +++ b/src/ResourceDisplay/SvgResourceDisplay.hpp @@ -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 . + */ + #pragma once #include "ResourceDisplay.hpp" #include diff --git a/src/ResourceManager.cpp b/src/ResourceManager.cpp index ed154a5..3daaa97 100644 --- a/src/ResourceManager.cpp +++ b/src/ResourceManager.cpp @@ -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 . + */ + #include "ResourceManager.hpp" #include #include diff --git a/src/ResourceManager.hpp b/src/ResourceManager.hpp index 101e451..33b5a33 100644 --- a/src/ResourceManager.hpp +++ b/src/ResourceManager.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/src/RichText/ParagraphStyleData.cpp b/src/RichText/ParagraphStyleData.cpp index b2eedbb..cc1e9cf 100644 --- a/src/RichText/ParagraphStyleData.cpp +++ b/src/RichText/ParagraphStyleData.cpp @@ -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 . + */ + #include "ParagraphStyleData.hpp" namespace RichText { diff --git a/src/RichText/ParagraphStyleData.hpp b/src/RichText/ParagraphStyleData.hpp index 8ac1d6c..6eadacb 100644 --- a/src/RichText/ParagraphStyleData.hpp +++ b/src/RichText/ParagraphStyleData.hpp @@ -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 . + */ + #pragma once #include diff --git a/src/RichText/TextBox.cpp b/src/RichText/TextBox.cpp index 825db7e..1f05a01 100644 --- a/src/RichText/TextBox.cpp +++ b/src/RichText/TextBox.cpp @@ -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 . + */ + #include "TextBox.hpp" #include "Helpers/Networking/ByteStream.hpp" #include "TextStyleModifier.hpp" @@ -360,6 +378,68 @@ TextPosition TextBox::get_text_pos_closest_to_point(Vector2f point) { return TextPosition{pIndex, 0}; } +int TextBox::get_codepoint_location_from_text_position(TextPosition pos) { + pos = move(Movement::NOWHERE, pos); + std::string str = get_string(); + size_t bytePos = get_byte_pos_from_text_pos(pos); + const char* utf8StartPtr = str.c_str(); + const char* utf8EndPtr = str.c_str() + bytePos; + const char* utf8StringEndPtr = str.c_str() + str.size(); + int i = 0; + for(; utf8StartPtr < utf8EndPtr; i++) { + SkUnichar u = SkUTF::NextUTF8(&utf8StartPtr, utf8StringEndPtr); + if(u == -1) + return 0; + } + return i; +} + +TextPosition TextBox::get_text_position_from_codepoint_location(int p) { + std::string str = get_string(); + const char* utf8StartPtr = str.c_str(); + const char* utf8StringEndPtr = str.c_str() + str.size(); + for(int i = 0; i < p; i++) { + SkUnichar u = SkUTF::NextUTF8(&utf8StartPtr, utf8StringEndPtr); + if(u == -1) + return move(Movement::HOME, {0, 0}); + else if(utf8StartPtr == utf8StringEndPtr) + return move(Movement::END, {0, 0}); + } + size_t bytePos = utf8StartPtr - str.c_str(); + return get_text_pos_from_byte_pos(str, bytePos); +} + +int TextBox::get_utf16_location_from_codepoint_location(int p) { + std::string u8s = get_string(); + std::u16string str = SkUnicodes::ICU::Make()->convertUtf8ToUtf16(u8s.c_str(), u8s.length()); + const uint16_t* utf16StartPtr = reinterpret_cast(str.data()); + const uint16_t* utf16StringEndPtr = reinterpret_cast(str.data()) + str.size(); + for(int i = 0; i < p; i++) { + SkUnichar u = SkUTF::NextUTF16(&utf16StartPtr, utf16StringEndPtr); + if(u == -1) + return 0; + else if(utf16StartPtr == utf16StringEndPtr) + return str.length(); + } + size_t u16Pos = utf16StartPtr - (const uint16_t*)str.c_str(); + return u16Pos; +} + +int TextBox::get_codepoint_location_from_utf16_location(int p) { + std::string u8s = get_string(); + std::u16string str = SkUnicodes::ICU::Make()->convertUtf8ToUtf16(u8s.c_str(), u8s.length()); + const uint16_t* utf16StartPtr = reinterpret_cast(str.data()); + const uint16_t* utf16EndPtr = reinterpret_cast(str.data()) + p; + const uint16_t* utf16StringEndPtr = reinterpret_cast(str.data()) + str.size(); + int i = 0; + for(; utf16StartPtr < utf16EndPtr; i++) { + SkUnichar u = SkUTF::NextUTF16(&utf16StartPtr, utf16StringEndPtr); + if(u == -1) + return 0; + } + return i; +} + TextData TextBox::get_rich_text_data() { TextData toRet; for(auto& p : paragraphs) { @@ -643,8 +723,7 @@ TextPosition TextBox::move(Movement movement, TextPosition pos, std::optional= paragraphs[pos.fParagraphIndex].text.size()) pos.fTextByteIndex = paragraphs[pos.fParagraphIndex].text.size(); - if(movement != Movement::NOWHERE && movement != Movement::HOME && movement != Movement::END) { - rebuild(); + if(movement != Movement::NOWHERE && movement != Movement::HOME && movement != Movement::END) { if(flipDependingOnTextDirection && paragraphs[pos.fParagraphIndex].pStyleData.textDirection == skia::textlayout::TextDirection::kRtl) { if(movement == Movement::LEFT) movement = Movement::RIGHT; diff --git a/src/RichText/TextBox.hpp b/src/RichText/TextBox.hpp index 2bc0ffe..cebd669 100644 --- a/src/RichText/TextBox.hpp +++ b/src/RichText/TextBox.hpp @@ -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 . + */ + #pragma once #include #include @@ -106,6 +124,11 @@ class TextBox { bool skiaAA = false; }; + int get_codepoint_location_from_text_position(TextPosition pos); + TextPosition get_text_position_from_codepoint_location(int p); + int get_utf16_location_from_codepoint_location(int p); + int get_codepoint_location_from_utf16_location(int p); + TextPosition move(Movement movement, TextPosition pos, std::optional* previousX = nullptr, bool flipDependingOnTextDirection = false); void set_max_width(float newWidth); void set_max_height(float newMaxHeight); @@ -166,6 +189,8 @@ class TextBox { SkRect get_cursor_rect(TextPosition pos); skia::textlayout::TextDirection get_suggested_direction(size_t pIndex); + + TextPosition get_text_pos_closest_to_point(Vector2f point); private: std::pair get_start_end_text_pos(TextPosition p1, TextPosition p2); std::pair get_start_end_paragraph_pos(size_t p1, size_t p2); @@ -180,7 +205,6 @@ class TextBox { void rects_between_text_positions_func(TextPosition p1, TextPosition p2, std::function f); - TextPosition get_text_pos_closest_to_point(Vector2f point); std::shared_ptr get_last_text_style_mod_before_pos(TextPosition pos, TextStyleModifier::ModifierType modType); void erase_if_over_all_styles_until_pos(TextPosition pos, const std::function&)>& func); void insert_style_at_pos(TextPosition pos, const std::shared_ptr& modifier); diff --git a/src/RichText/TextStyleModifier.cpp b/src/RichText/TextStyleModifier.cpp index 788118a..388fff2 100644 --- a/src/RichText/TextStyleModifier.cpp +++ b/src/RichText/TextStyleModifier.cpp @@ -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 . + */ + #include "TextStyleModifier.hpp" #include #include diff --git a/src/RichText/TextStyleModifier.hpp b/src/RichText/TextStyleModifier.hpp index edc208c..33d63fe 100644 --- a/src/RichText/TextStyleModifier.hpp +++ b/src/RichText/TextStyleModifier.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/src/RichTextUserInput.cpp b/src/RichTextUserInput.cpp index 6b51816..150b9b3 100644 --- a/src/RichTextUserInput.cpp +++ b/src/RichTextUserInput.cpp @@ -1,5 +1,25 @@ +/* + * 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 . + */ + #include "RichTextUserInput.hpp" #include "CustomEvents.hpp" +#include "AndroidJNICalls.hpp" +#include "RichText/TextBox.hpp" template std::optional shared_ptr_to_opt(const std::shared_ptr o) { if(o) @@ -8,13 +28,33 @@ template std::optional shared_ptr_to_opt(const std::shared_ptr& initTextBox, const std::shared_ptr& initCursor, const std::shared_ptr& initModMap): +RichTextUserInput::RichTextUserInput(CustomEvents::InputTextBoxID initId, const std::shared_ptr& initTextBox, const std::shared_ptr& initCursor, const std::shared_ptr& initModMap): id(initId), textBox(initTextBox), cursor(initCursor), modMap(initModMap) {} +void RichTextUserInput::android_force_update_modmap() { +#ifdef __ANDROID__ + AndroidJNICalls::updateModMap(id, modMap); +#endif +} + +void RichTextUserInput::android_force_update_textbox_and_cursor() { +#ifdef __ANDROID__ + AndroidJNICalls::updateTextboxAndCursorPos(id, textBox, cursor); +#endif + android_force_update_modmap(); +} + +void RichTextUserInput::android_force_update_cursor() { +#ifdef __ANDROID__ + AndroidJNICalls::updateCursorPos(id, cursor); +#endif + android_force_update_modmap(); +} + bool RichTextUserInput::input_paste_callback(const CustomEvents::PasteEvent& paste) { if(paste.type == CustomEvents::PasteEvent::DataType::TEXT) { do_textbox_operation_with_undo([&]() { @@ -23,11 +63,35 @@ bool RichTextUserInput::input_paste_callback(const CustomEvents::PasteEvent& pas else textBox->process_text_input(*cursor, paste.data, shared_ptr_to_opt(modMap)); }); + android_force_update_textbox_and_cursor(); return true; } return false; } +RichTextUserInput::Changes RichTextUserInput::input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput) { + RichTextUserInput::Changes toRet{false, false}; + switch(textboxInput.command) { + case CustomEvents::AndroidTextBoxInputEvent::CommandType::COMMIT_ALL: { + #ifdef __ANDROID__ + std::pair c = AndroidJNICalls::getChangesToCommit(id); + toRet.textEdited = c.first; + toRet.cursorChanged = c.second; + if(toRet.textEdited) + do_textbox_operation_with_undo([&]() { + AndroidJNICalls::commitAll(id, textBox, cursor); + }); + else + AndroidJNICalls::commitAll(id, textBox, cursor); + #else + toRet.textEdited = toRet.cursorChanged = false; + #endif + break; + } + } + return toRet; +} + void RichTextUserInput::add_text_to_textbox(const std::string& inputText) { do_textbox_operation_with_undo([&]() { textBox->process_text_input(*cursor, inputText, shared_ptr_to_opt(modMap)); @@ -56,6 +120,27 @@ void RichTextUserInput::do_textbox_operation_with_undo(const std::functionprocess_mouse_left_button(*cursor, pos, clickCount, held, shift); + if(oldCursor != *cursor) + android_force_update_cursor(); +} + +void RichTextUserInput::input_finger_touch_down(const Vector2f& pos) { + RichText::TextBox::Cursor oldCursor = *cursor; + cursor->pos = cursor->selectionBeginPos = cursor->selectionEndPos = textBox->get_text_pos_closest_to_point(pos); + if(oldCursor != *cursor) + android_force_update_cursor(); +} + +void RichTextUserInput::input_finger_held_motion(const Vector2f& pos) { + RichText::TextBox::Cursor oldCursor = *cursor; + cursor->pos = cursor->selectionEndPos = textBox->get_text_pos_closest_to_point(pos); + if(oldCursor != *cursor) + android_force_update_cursor(); +} + RichTextUserInput::Changes RichTextUserInput::input_key_callback(InputManager& input, const InputManager::KeyCallbackArgs& key) { std::optional modMapOpt = shared_ptr_to_opt(modMap); @@ -134,6 +219,10 @@ RichTextUserInput::Changes RichTextUserInput::input_key_callback(InputManager& i return toRet; } toRet.cursorChanged = oldCursor != *cursor; + if(toRet.textEdited) + android_force_update_textbox_and_cursor(); + else if(toRet.cursorChanged) + android_force_update_cursor(); } return toRet; } diff --git a/src/RichTextUserInput.hpp b/src/RichTextUserInput.hpp index f88f4a3..d94b138 100644 --- a/src/RichTextUserInput.hpp +++ b/src/RichTextUserInput.hpp @@ -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 . + */ + #pragma once #include "CustomEvents.hpp" #include "RichText/TextBox.hpp" @@ -6,17 +24,24 @@ class RichTextUserInput { public: - RichTextUserInput(InputManager::TextBoxID initId, const std::shared_ptr& initTextBox, const std::shared_ptr& initCursor, const std::shared_ptr& initModMap); + RichTextUserInput(CustomEvents::InputTextBoxID initId, const std::shared_ptr& initTextBox, const std::shared_ptr& initCursor, const std::shared_ptr& initModMap); struct Changes { bool textEdited = false; bool cursorChanged = false; }; Changes input_key_callback(InputManager& input, const InputManager::KeyCallbackArgs& key); bool input_paste_callback(const CustomEvents::PasteEvent& paste); + Changes input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput); void add_text_to_textbox(const std::string& inputText); void do_textbox_operation_with_undo(const std::function& func); void add_textbox_undo(const RichText::TextBox::Cursor& prevCursor, const RichText::TextData& prevRichText); - const InputManager::TextBoxID id; + void process_mouse_left_button(const Vector2f& pos, int clickCount, bool held, bool shift); + void input_finger_touch_down(const Vector2f& pos); + void input_finger_held_motion(const Vector2f& pos); + void android_force_update_modmap(); + void android_force_update_textbox_and_cursor(); + void android_force_update_cursor(); + const CustomEvents::InputTextBoxID id; private: std::shared_ptr textBox; std::shared_ptr cursor; diff --git a/src/ScaleUpCanvas.cpp b/src/ScaleUpCanvas.cpp index 8bc7a95..d55674d 100644 --- a/src/ScaleUpCanvas.cpp +++ b/src/ScaleUpCanvas.cpp @@ -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 . + */ + #include "ScaleUpCanvas.hpp" WorldScalar get_canvas_scale_up_amount(uint32_t newGridSize, uint32_t oldGridSize) { diff --git a/src/ScaleUpCanvas.hpp b/src/ScaleUpCanvas.hpp index c1c7ea0..defe101 100644 --- a/src/ScaleUpCanvas.hpp +++ b/src/ScaleUpCanvas.hpp @@ -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 . + */ + #pragma once #include #include "World.hpp" diff --git a/src/Screens/DesktopDrawingProgramScreen.cpp b/src/Screens/DesktopDrawingProgramScreen.cpp index b5e8bab..71599cd 100644 --- a/src/Screens/DesktopDrawingProgramScreen.cpp +++ b/src/Screens/DesktopDrawingProgramScreen.cpp @@ -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 . + */ + #include "DesktopDrawingProgramScreen.hpp" #include "../MainProgram.hpp" #include "DrawingProgramScreen.hpp" diff --git a/src/Screens/DesktopDrawingProgramScreen.hpp b/src/Screens/DesktopDrawingProgramScreen.hpp index 558c8a2..081dc0a 100644 --- a/src/Screens/DesktopDrawingProgramScreen.hpp +++ b/src/Screens/DesktopDrawingProgramScreen.hpp @@ -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 . + */ + #pragma once #include "DrawingProgramScreen.hpp" #include "../Toolbar.hpp" diff --git a/src/Screens/DrawingProgramScreen.cpp b/src/Screens/DrawingProgramScreen.cpp index 8531370..f29e229 100644 --- a/src/Screens/DrawingProgramScreen.cpp +++ b/src/Screens/DrawingProgramScreen.cpp @@ -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 . + */ + #include "DrawingProgramScreen.hpp" #include "../MainProgram.hpp" @@ -25,6 +43,10 @@ void DrawingProgramScreen::input_paste_callback(const CustomEvents::PasteEvent& main.world->input_paste_callback(paste); } +void DrawingProgramScreen::input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput) { + main.world->input_android_text_box_input_callback(textboxInput); +} + void DrawingProgramScreen::input_drop_file_callback(const InputManager::DropCallbackArgs& drop) { if(std::filesystem::is_regular_file(drop.data)) { std::filesystem::path droppedFilePath(drop.data); diff --git a/src/Screens/DrawingProgramScreen.hpp b/src/Screens/DrawingProgramScreen.hpp index 1faaff5..7f9710c 100644 --- a/src/Screens/DrawingProgramScreen.hpp +++ b/src/Screens/DrawingProgramScreen.hpp @@ -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 . + */ + #pragma once #include "Screen.hpp" @@ -9,6 +27,7 @@ class DrawingProgramScreen : public Screen { virtual void input_add_file_to_canvas_callback(const CustomEvents::AddFileToCanvasEvent& addFile) override; virtual void input_open_infinipaint_file_callback(const CustomEvents::OpenInfiniPaintFileEvent& openFile) 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_drop_file_callback(const InputManager::DropCallbackArgs& drop) override; virtual void input_drop_text_callback(const InputManager::DropCallbackArgs& drop) override; virtual void input_key_callback(const InputManager::KeyCallbackArgs& key) override; diff --git a/src/Screens/FileSelectScreen.cpp b/src/Screens/FileSelectScreen.cpp index 1d967a6..83a6829 100644 --- a/src/Screens/FileSelectScreen.cpp +++ b/src/Screens/FileSelectScreen.cpp @@ -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 . + */ + #include "FileSelectScreen.hpp" #include "../MainProgram.hpp" #include "../GUIHolder.hpp" diff --git a/src/Screens/FileSelectScreen.hpp b/src/Screens/FileSelectScreen.hpp index 66deb18..67ac63c 100644 --- a/src/Screens/FileSelectScreen.hpp +++ b/src/Screens/FileSelectScreen.hpp @@ -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 . + */ + #pragma once #include "Screen.hpp" #include "nlohmann/json.hpp" diff --git a/src/Screens/PhoneDrawingProgramScreen.cpp b/src/Screens/PhoneDrawingProgramScreen.cpp index b6cbc1d..c7a4bb7 100644 --- a/src/Screens/PhoneDrawingProgramScreen.cpp +++ b/src/Screens/PhoneDrawingProgramScreen.cpp @@ -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 . + */ + #include "PhoneDrawingProgramScreen.hpp" #include "../MainProgram.hpp" #include "DrawingProgramScreen.hpp" @@ -94,93 +112,120 @@ void PhoneDrawingProgramScreen::bottom_toolbar() { .childAlignment = { .x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_CENTER} } }) { - 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_FIT(0) }, - .childAlignment = { .x = CLAY_ALIGN_X_LEFT, .y = CLAY_ALIGN_Y_BOTTOM}, - .layoutDirection = CLAY_LEFT_TO_RIGHT - } - }) { - switch(settingsMenuPopup) { - case SettingsMenuPopup::NONE: - reset_color_picker_popup_data(); - break; - case SettingsMenuPopup::SETTINGS: + if(main.world->drawProg.phone_gui_tool_specific_bottom_toolbar_exists()) + main.world->drawProg.phone_gui_tool_specific_bottom_toolbar(*this); + else + default_bottom_toolbar(); + } + }); +} + +void PhoneDrawingProgramScreen::default_bottom_toolbar() { + auto& gui = 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_FIT(0) }, + .childAlignment = { .x = CLAY_ALIGN_X_LEFT, .y = CLAY_ALIGN_Y_BOTTOM}, + .layoutDirection = CLAY_LEFT_TO_RIGHT + } + }) { + switch(settingsMenuPopup) { + case SettingsMenuPopup::NONE: + reset_color_picker_popup_data(); + colorPickerPtr = nullptr; + break; + case SettingsMenuPopup::SETTINGS: + colorPickerPtr = main.world->drawProg.color_picker_right(colorPickerPtr); + if(colorPickerPtr) { + if(colorPickerPopupData.screenType == ColorPickerPopupData::ScreenType::NORMAL) { CLAY_AUTO_ID({ .layout = { .sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(0) }, } }) {} - reset_color_picker_popup_data(); - tool_settings_popup(); - break; - case SettingsMenuPopup::FG_COLOR: - case SettingsMenuPopup::BG_COLOR: - if(colorPickerPopupData.screenType == ColorPickerPopupData::ScreenType::NORMAL) { - CLAY_AUTO_ID({ - .layout = { - .sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(0) }, - } - }) {} + } + color_settings_popup(colorPickerPtr, colorPickerData, [&] { + colorPickerPtr = nullptr; + }); + } + else { + CLAY_AUTO_ID({ + .layout = { + .sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(0) }, } - color_settings_popup(settingsMenuPopup == SettingsMenuPopup::FG_COLOR ? &main.toolConfig.globalConf.foregroundColor : &main.toolConfig.globalConf.backgroundColor); - break; + }) {} + reset_color_picker_popup_data(); + tool_settings_popup(); } - } - - 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 + break; + case SettingsMenuPopup::FG_COLOR: + case SettingsMenuPopup::BG_COLOR: + if(colorPickerPopupData.screenType == ColorPickerPopupData::ScreenType::NORMAL) { + CLAY_AUTO_ID({ + .layout = { + .sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(0) }, + } + }) {} } - }) { - gui.element("bottom toolbar", [&](LayoutElement*, const Clay_ElementId& lId) { - CLAY(lId, { - .layout = { - .sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0)} - }, - .backgroundColor = convert_vec4(io.theme->backColor1), - .cornerRadius = CLAY_CORNER_RADIUS(io.theme->windowCorners1) - }) { - gui.clipping_element("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&) { - bottom_toolbar_gui(); - } - }); - } - }); - gui.element("bottom extra toolbar", [&](LayoutElement*, const Clay_ElementId& lId) { - CLAY(lId, { - .layout = { - .sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0)}, - .layoutDirection = CLAY_LEFT_TO_RIGHT - }, - .backgroundColor = convert_vec4(io.theme->backColor1), - .cornerRadius = CLAY_CORNER_RADIUS(io.theme->windowCorners1) - }) { - bottom_extra_toolbar_gui(); - } - }); - } + colorPickerData = ColorSelectorData(); + colorPickerPtr = nullptr; + color_settings_popup(settingsMenuPopup == SettingsMenuPopup::FG_COLOR ? &main.toolConfig.globalConf.foregroundColor : &main.toolConfig.globalConf.backgroundColor, {}, nullptr); + 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("bottom toolbar", [&](LayoutElement*, const Clay_ElementId& lId) { + CLAY(lId, { + .layout = { + .sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0)} + }, + .backgroundColor = convert_vec4(io.theme->backColor1), + .cornerRadius = CLAY_CORNER_RADIUS(io.theme->windowCorners1) + }) { + gui.clipping_element("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&) { + bottom_toolbar_gui(); + } + }); + } + }); + gui.element("bottom extra toolbar", [&](LayoutElement*, const Clay_ElementId& lId) { + CLAY(lId, { + .layout = { + .sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0)}, + .layoutDirection = CLAY_LEFT_TO_RIGHT + }, + .backgroundColor = convert_vec4(io.theme->backColor1), + .cornerRadius = CLAY_CORNER_RADIUS(io.theme->windowCorners1) + }) { + bottom_extra_toolbar_gui(); + } + }); + } + } } void PhoneDrawingProgramScreen::bottom_toolbar_gui() { @@ -192,6 +237,8 @@ void PhoneDrawingProgramScreen::bottom_toolbar_gui() { .drawType = SelectableButton::DrawType::TRANSPARENT_ALL, .isSelected = drawP.drawTool->get_type() == toolType, .onClick = [&, toolType] { + if(toolType == DrawingProgramToolType::EDIT) + settingsMenuPopup = SettingsMenuPopup::SETTINGS; drawP.switch_to_tool(toolType); } }); @@ -251,23 +298,39 @@ void PhoneDrawingProgramScreen::reset_color_picker_popup_data() { colorPickerPopupData.paletteListSelection.clear(); } -void PhoneDrawingProgramScreen::color_settings_popup(Vector4f* color) { +void PhoneDrawingProgramScreen::color_settings_popup(Vector4f* color, const ColorSelectorData& d, std::function backOnPaletteButton, bool setAlphaToOne, bool setToTransparentCancelButton) { auto& gui = main.g.gui; auto& palette = main.conf.palettes[colorPickerPopupData.selectedPalette]; - bool extraSettingsOpen = colorPickerPopupData.screenType == ColorPickerPopupData::ScreenType::EXTRA; - bool extraColorButtons = extraSettingsOpen && colorPickerPopupData.selectedPalette != 0; + int extraColorButtonCount = 1; + if(colorPickerPopupData.screenType == ColorPickerPopupData::ScreenType::NORMAL) { + if(backOnPaletteButton) + extraColorButtonCount++; + if(setToTransparentCancelButton) + extraColorButtonCount++; + } + else if(colorPickerPopupData.screenType == ColorPickerPopupData::ScreenType::EXTRA && colorPickerPopupData.selectedPalette != 0) + extraColorButtonCount = 3; + + auto paletteButtonChange = [d] () { + if(d.onSelect) d.onSelect(); + if(d.onChange) d.onChange(); + if(d.onDeselect) d.onDeselect(); + }; auto paletteColorPickerGridColorButton = [&](size_t i){ auto newC = std::make_shared(palette.colors[i].x(), palette.colors[i].y(), palette.colors[i].z()); color_button(gui, "c", newC.get(), { .isSelected = newC->x() == color->x() && newC->y() == color->y() && newC->z() == color->z(), .hasAlpha = false, - .onClick = [newC, color] { + .onClick = [setAlphaToOne, newC, color, paletteButtonChange] { // We want to keep the old color's alpha color->x() = newC->x(); color->y() = newC->y(); color->z() = newC->z(); + if(setAlphaToOne) + color->w() = 1.0f; + paletteButtonChange(); } }); }; @@ -277,24 +340,44 @@ void PhoneDrawingProgramScreen::color_settings_popup(Vector4f* color) { .entryWidth = BIG_BUTTON_SIZE, .childAlignmentX = CLAY_ALIGN_X_CENTER, .entryHeight = BIG_BUTTON_SIZE, - .entryCount = palette.colors.size() + (extraColorButtons ? 3 : 1), + .entryCount = palette.colors.size() + extraColorButtonCount, .scrollbar = ScrollArea::ScrollbarType::NORMAL, .elementContent = [&](size_t i) { if(colorPickerPopupData.screenType == ColorPickerPopupData::ScreenType::NORMAL) { - if(i < palette.colors.size()) - paletteColorPickerGridColorButton(i); - else { - svg_icon_button(gui, "extra color settings", "data/icons/RemixIcon/more-fill.svg", { + int32_t newI = static_cast(i); + if(backOnPaletteButton) + newI--; + if(newI == -1) + svg_icon_button(gui, "back on palette button", "data/icons/RemixIcon/arrow-left-s-line.svg", { .drawType = SelectableButton::DrawType::TRANSPARENT_ALL, - .onClick = [&] { - colorPickerPopupData.screenType = ColorPickerPopupData::ScreenType::EXTRA; - } + .onClick = backOnPaletteButton }); + else if(newI < static_cast(palette.colors.size())) + paletteColorPickerGridColorButton(newI); + else { + if(newI == static_cast(palette.colors.size()) && setToTransparentCancelButton) + svg_icon_button(gui, "set to transparent button", "data/icons/close.svg", { + .drawType = SelectableButton::DrawType::TRANSPARENT_ALL, + .onClick = [&, color, paletteButtonChange] { + color->x() = 0.0f; + color->y() = 0.0f; + color->z() = 0.0f; + color->w() = 0.0f; + paletteButtonChange(); + } + }); + else + svg_icon_button(gui, "extra color settings", "data/icons/RemixIcon/more-fill.svg", { + .drawType = SelectableButton::DrawType::TRANSPARENT_ALL, + .onClick = [&] { + colorPickerPopupData.screenType = ColorPickerPopupData::ScreenType::EXTRA; + } + }); } } else { if(i == 0) { - svg_icon_button(gui, "extra color settings", "data/icons/RemixIcon/arrow-left-s-line.svg", { + svg_icon_button(gui, "extra color settings back button", "data/icons/RemixIcon/arrow-left-s-line.svg", { .drawType = SelectableButton::DrawType::TRANSPARENT_ALL, .onClick = [&] { colorPickerPopupData.screenType = ColorPickerPopupData::ScreenType::NORMAL; @@ -303,7 +386,7 @@ void PhoneDrawingProgramScreen::color_settings_popup(Vector4f* color) { } else if((i - 1) < palette.colors.size()) paletteColorPickerGridColorButton(i - 1); - else if(extraColorButtons) { + else if(colorPickerPopupData.selectedPalette != 0) { switch(i - palette.colors.size() - 1) { case 0: svg_icon_button(gui, "addcolor", "data/icons/plus.svg", { @@ -329,7 +412,7 @@ void PhoneDrawingProgramScreen::color_settings_popup(Vector4f* color) { }); }; - auto paletteColorPickerExtras = [&] { + auto paletteColorPickerExtras = [&, d] { CLAY_AUTO_ID({ .layout = { .sizing = {.width = CLAY_SIZING_FIT(200), .height = CLAY_SIZING_GROW(0)}, @@ -339,9 +422,12 @@ void PhoneDrawingProgramScreen::color_settings_popup(Vector4f* color) { .aspectRatio = {1.0f} }) { gui.element>("color picker element", color, true, ColorPickerData{ - .onChange = [&] { + .onChange = [&, d] { + if(d.onChange) d.onChange(); gui.set_to_layout(); - } + }, + .onHold = d.onSelect, + .onRelease = d.onDeselect }); } CLAY_AUTO_ID({ @@ -553,3 +639,28 @@ void PhoneDrawingProgramScreen::input_global_back_button_callback() { void PhoneDrawingProgramScreen::input_app_about_to_go_to_background_callback() { main.world->save_to_file(main.world->filePath); } + +void PhoneDrawingProgramScreen::color_selector(Vector4f* color, const ColorSelectorData& colorSelectorData) { + if(colorPickerPtr != color) { + colorPickerPtr = color; + colorPickerData = colorSelectorData; + } + else + colorPickerPtr = nullptr; + main.g.gui.set_to_layout(); +} + +void PhoneDrawingProgramScreen::color_selector_button(const char* id, Vector4f* color, const ColorSelectorButtonData& colorSelectorData) { + auto& gui = main.g.gui; + color_button(gui, id, color, { + .isSelected = colorPickerPtr == color, + .onClick = [&, colorSelectorData, color] { + if(colorSelectorData.onSelectorButtonClick) colorSelectorData.onSelectorButtonClick(); + color_selector(color, { + .onChange = colorSelectorData.onChange, + .onSelect = colorSelectorData.onSelect, + .onDeselect = colorSelectorData.onDeselect, + }); + } + }); +} diff --git a/src/Screens/PhoneDrawingProgramScreen.hpp b/src/Screens/PhoneDrawingProgramScreen.hpp index a983e84..04cc4ec 100644 --- a/src/Screens/PhoneDrawingProgramScreen.hpp +++ b/src/Screens/PhoneDrawingProgramScreen.hpp @@ -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 . + */ + #pragma once #include "DrawingProgramScreen.hpp" #include "../Toolbar.hpp" @@ -10,21 +28,17 @@ class PhoneDrawingProgramScreen : public DrawingProgramScreen { virtual void gui_layout_run() override; virtual void input_global_back_button_callback() override; virtual void input_app_about_to_go_to_background_callback() override; - private: - void bottom_toolbar_gui(); - void bottom_extra_toolbar_gui(); - void save_files(); - void top_toolbar(); - void bottom_toolbar(); - void main_display(); - void tool_settings_popup(); - void color_settings_popup(Vector4f* color); - enum class SettingsMenuPopup { - NONE, - SETTINGS, - FG_COLOR, - BG_COLOR - } settingsMenuPopup = SettingsMenuPopup::NONE; + struct ColorSelectorData { + std::function onChange; + std::function onSelect; + std::function onDeselect; + }; + struct ColorSelectorButtonData { + std::function onSelectorButtonClick; + std::function onChange; + std::function onSelect; + std::function onDeselect; + }; struct ColorPickerPopupData { enum class ScreenType { NORMAL, @@ -35,5 +49,26 @@ class PhoneDrawingProgramScreen : public DrawingProgramScreen { std::string newPaletteStr; std::set paletteListSelection; } colorPickerPopupData; + void color_selector(Vector4f* color, const ColorSelectorData& colorSelectorData = {}); + void color_selector_button(const char* id, Vector4f* color, const ColorSelectorButtonData& colorSelectorData = {}); + void color_settings_popup(Vector4f* color, const ColorSelectorData& d, std::function backOnPaletteButton = nullptr, bool setAlphaToOne = false, bool setToTransparentCancelButton = false); void reset_color_picker_popup_data(); + private: + void default_bottom_toolbar(); + void bottom_toolbar_gui(); + void bottom_extra_toolbar_gui(); + void save_files(); + void top_toolbar(); + void bottom_toolbar(); + void main_display(); + void tool_settings_popup(); + enum class SettingsMenuPopup { + NONE, + SETTINGS, + FG_COLOR, + BG_COLOR + } settingsMenuPopup = SettingsMenuPopup::NONE; + + Vector4f* colorPickerPtr = nullptr; + ColorSelectorData colorPickerData; }; diff --git a/src/Screens/Screen.cpp b/src/Screens/Screen.cpp index 3fd4c75..aed0f13 100644 --- a/src/Screens/Screen.cpp +++ b/src/Screens/Screen.cpp @@ -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 . + */ + #include "Screen.hpp" Screen::Screen(MainProgram& m): @@ -10,6 +28,7 @@ bool Screen::app_close_requested() { return true; } void Screen::input_add_file_to_canvas_callback(const CustomEvents::AddFileToCanvasEvent& addFile) {} void Screen::input_open_infinipaint_file_callback(const CustomEvents::OpenInfiniPaintFileEvent& openFile) {} void Screen::input_paste_callback(const CustomEvents::PasteEvent& paste) {} +void Screen::input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput) {} void Screen::input_global_back_button_callback() {} void Screen::input_drop_file_callback(const InputManager::DropCallbackArgs& drop) {} void Screen::input_drop_text_callback(const InputManager::DropCallbackArgs& drop) {} diff --git a/src/Screens/Screen.hpp b/src/Screens/Screen.hpp index df09674..a27544f 100644 --- a/src/Screens/Screen.hpp +++ b/src/Screens/Screen.hpp @@ -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 . + */ + #pragma once #include "../InputManager.hpp" @@ -12,6 +30,7 @@ class Screen { virtual void input_add_file_to_canvas_callback(const CustomEvents::AddFileToCanvasEvent& addFile); virtual void input_open_infinipaint_file_callback(const CustomEvents::OpenInfiniPaintFileEvent& openFile); virtual void input_paste_callback(const CustomEvents::PasteEvent& paste); + virtual void input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput); virtual void input_global_back_button_callback(); virtual void input_drop_file_callback(const InputManager::DropCallbackArgs& drop); virtual void input_drop_text_callback(const InputManager::DropCallbackArgs& drop); diff --git a/src/SharedTypes.hpp b/src/SharedTypes.hpp index e254914..e62f70d 100644 --- a/src/SharedTypes.hpp +++ b/src/SharedTypes.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/src/SwitchCWD.cpp b/src/SwitchCWD.cpp index ffef00b..0352470 100755 --- a/src/SwitchCWD.cpp +++ b/src/SwitchCWD.cpp @@ -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 . + */ + #include "SwitchCWD.hpp" #include #include diff --git a/src/SwitchCWD.hpp b/src/SwitchCWD.hpp index 535a166..95b4f57 100755 --- a/src/SwitchCWD.hpp +++ b/src/SwitchCWD.hpp @@ -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 . + */ + #pragma once void switch_cwd(); diff --git a/src/TimePoint.cpp b/src/TimePoint.cpp index 390ae8b..0f200aa 100644 --- a/src/TimePoint.cpp +++ b/src/TimePoint.cpp @@ -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 . + */ + #include "TimePoint.hpp" TimePoint::TimePoint(): diff --git a/src/TimePoint.hpp b/src/TimePoint.hpp index 6f2ba95..0dc5298 100644 --- a/src/TimePoint.hpp +++ b/src/TimePoint.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/src/Toolbar.cpp b/src/Toolbar.cpp index 5d1449f..ae8c357 100644 --- a/src/Toolbar.cpp +++ b/src/Toolbar.cpp @@ -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 . + */ + #include "Toolbar.hpp" #include "CustomEvents.hpp" #include "DrawingProgram/Tools/DrawingProgramToolBase.hpp" @@ -1168,6 +1186,7 @@ void Toolbar::drawing_program_gui() { }) { main.world->drawProg.toolbar_gui(*this); + colorLeft = main.world->drawProg.color_picker_left(colorLeft); if(colorLeft) color_picker_window("Drawing program gui color picker left", &colorLeft, colorLeftButton, colorLeftData); CLAY_AUTO_ID({ @@ -1175,6 +1194,7 @@ void Toolbar::drawing_program_gui() { .sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0)} } }) {} + colorRight = main.world->drawProg.color_picker_right(colorRight); if(colorRight) color_picker_window("Drawing program gui color picker right", &colorRight, colorRightButton, colorRightData); diff --git a/src/Toolbar.hpp b/src/Toolbar.hpp index 8d2ee20..7518b18 100644 --- a/src/Toolbar.hpp +++ b/src/Toolbar.hpp @@ -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 . + */ + #pragma once #include "GUIStuff/Elements/ScrollArea.hpp" #include "DrawData.hpp" @@ -36,6 +54,7 @@ class Toolbar { Toolbar(MainProgram& initMain); void update(); void layout_run(); + struct ColorSelectorData { std::function onChange; std::function onSelect; @@ -47,6 +66,7 @@ class Toolbar { std::function onSelect; std::function onDeselect; }; + void color_selector_left(GUIStuff::Element* button, Vector4f* color, const ColorSelectorData& colorSelectorData = {}); void color_selector_right(GUIStuff::Element* button, Vector4f* color, const ColorSelectorData& colorSelectorData = {}); void color_button_left(const char* id, Vector4f* color, const ColorSelectorButtonData& colorSelectorData = {}); @@ -62,14 +82,6 @@ class Toolbar { void open_chatbox(); void close_chatbox(); - GUIStuff::Element* colorLeftButton; - Vector4f* colorLeft = nullptr; - ColorSelectorData colorLeftData; - - GUIStuff::Element* colorRightButton; - Vector4f* colorRight = nullptr; - ColorSelectorData colorRightData; - bool drawGui = true; bool app_close_requested(); @@ -108,6 +120,14 @@ class Toolbar { void general_settings_inner_gui(); void center_obstructing_window_gui(const char* id, Clay_SizingAxis x, Clay_SizingAxis y, const std::function& innerContent); + GUIStuff::Element* colorLeftButton; + Vector4f* colorLeft = nullptr; + ColorSelectorData colorLeftData; + + GUIStuff::Element* colorRightButton; + Vector4f* colorRight = nullptr; + ColorSelectorData colorRightData; + struct ClosePopupData { struct CloseWorldData { std::weak_ptr w; diff --git a/src/UndoManager.cpp b/src/UndoManager.cpp index 9beb771..d43d75a 100644 --- a/src/UndoManager.cpp +++ b/src/UndoManager.cpp @@ -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 . + */ + #include "UndoManager.hpp" #include diff --git a/src/UndoManager.hpp b/src/UndoManager.hpp index b561f3a..29d30d0 100644 --- a/src/UndoManager.hpp +++ b/src/UndoManager.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/src/VersionConstants.cpp b/src/VersionConstants.cpp index 4ad625b..096db9a 100644 --- a/src/VersionConstants.cpp +++ b/src/VersionConstants.cpp @@ -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 . + */ + #include "VersionConstants.hpp" #include diff --git a/src/VersionConstants.hpp b/src/VersionConstants.hpp index fd48f2e..305b87a 100644 --- a/src/VersionConstants.hpp +++ b/src/VersionConstants.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/src/World.cpp b/src/World.cpp index 6a21d2d..8818425 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -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 . + */ + #include "World.hpp" #include #include @@ -259,6 +277,11 @@ void World::input_paste_callback(const CustomEvents::PasteEvent& paste) { drawProg.input_paste_callback(paste); } +void World::input_android_text_box_input_callback(const CustomEvents::AndroidTextBoxInputEvent& textboxInput) { + if(!clientStillConnecting) + drawProg.input_android_text_box_input_callback(textboxInput); +} + void World::input_text_key_callback(const InputManager::KeyCallbackArgs& key) { if(!clientStillConnecting) drawProg.input_text_key_callback(key); diff --git a/src/World.hpp b/src/World.hpp index dfe1b86..8d7c7a1 100644 --- a/src/World.hpp +++ b/src/World.hpp @@ -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 . + */ + #pragma once #include #include @@ -95,6 +113,7 @@ class World { 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_file_callback(const InputManager::DropCallbackArgs& drop); void input_drop_text_callback(const InputManager::DropCallbackArgs& drop); void input_text_key_callback(const InputManager::KeyCallbackArgs& key); diff --git a/src/WorldGrid.cpp b/src/WorldGrid.cpp index ffdf10a..d66bf02 100644 --- a/src/WorldGrid.cpp +++ b/src/WorldGrid.cpp @@ -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 . + */ + #include "WorldGrid.hpp" #include "GridManager.hpp" #include "Helpers/MathExtras.hpp" diff --git a/src/WorldGrid.hpp b/src/WorldGrid.hpp index c604cc8..f139a37 100644 --- a/src/WorldGrid.hpp +++ b/src/WorldGrid.hpp @@ -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 . + */ + #pragma once #include #include "DrawData.hpp" diff --git a/src/WorldScreenshot.cpp b/src/WorldScreenshot.cpp index 715d9f7..80b4ab6 100644 --- a/src/WorldScreenshot.cpp +++ b/src/WorldScreenshot.cpp @@ -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 . + */ + #include "CoordSpaceHelper.hpp" #include "World.hpp" #include "MainProgram.hpp" diff --git a/src/WorldScreenshot.hpp b/src/WorldScreenshot.hpp index ccfec49..f32b822 100644 --- a/src/WorldScreenshot.hpp +++ b/src/WorldScreenshot.hpp @@ -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 . + */ + #pragma once #include #include "CoordSpaceHelper.hpp" diff --git a/src/WorldUndoManager.cpp b/src/WorldUndoManager.cpp index efdb28a..9756a61 100644 --- a/src/WorldUndoManager.cpp +++ b/src/WorldUndoManager.cpp @@ -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 . + */ + #include "WorldUndoManager.hpp" #include "World.hpp" #include "MainProgram.hpp" diff --git a/src/WorldUndoManager.hpp b/src/WorldUndoManager.hpp index b219d72..fc6fa97 100644 --- a/src/WorldUndoManager.hpp +++ b/src/WorldUndoManager.hpp @@ -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 . + */ + #pragma once #include #include diff --git a/src/main.cpp b/src/main.cpp index 7c17835..dd31c7c 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -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 . + */ + #include "CustomEvents.hpp" #include "Helpers/SCollision.hpp" #include "Helpers/StringHelpers.hpp" @@ -371,10 +389,6 @@ void init_logs(MainStruct& mS) { } SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) { -#ifdef __ANDROID__ - std::scoped_lock a{AndroidJNICalls::globalCallMutex}; -#endif - std::vector listOfFilesToOpenFromCommand; for(int i = 1; i < argc; i++) listOfFilesToOpenFromCommand.emplace_back(std::filesystem::canonical(std::filesystem::path(std::u8string_view(reinterpret_cast(argv[i]))))); @@ -598,10 +612,6 @@ void regular_draw(MainStruct& mS) { } SDL_AppResult SDL_AppIterate(void *appstate) { -#ifdef __ANDROID__ - std::scoped_lock a{AndroidJNICalls::globalCallMutex}; -#endif - std::chrono::steady_clock::time_point frameTimeStart = std::chrono::steady_clock::now(); MainStruct& mS = *((MainStruct*)appstate); @@ -641,10 +651,6 @@ SDL_AppResult SDL_AppIterate(void *appstate) { } SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) { -#ifdef __ANDROID__ - std::scoped_lock a{AndroidJNICalls::globalCallMutex}; -#endif - MainStruct& mS = *((MainStruct*)appstate); #ifdef NDEBUG @@ -802,8 +808,12 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) { mS.m->input_open_infinipaint_file_callback(*CustomEvents::get_event()); else if(event->type == CustomEvents::AddFileToCanvasEvent::EVENT_NUM) mS.m->input_add_file_to_canvas_callback(*CustomEvents::get_event()); - else if(event->type == CustomEvents::RefreshTextBoxInputEvent::EVENT_NUM) + else if(event->type == CustomEvents::RefreshTextBoxInputEvent::EVENT_NUM) { + CustomEvents::get_event(); mS.m->input.refresh_receiving_text_box_input(); + } + else if(event->type == CustomEvents::AndroidTextBoxInputEvent::EVENT_NUM) + mS.m->input_android_text_box_input_callback(*CustomEvents::get_event()); break; } }