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

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "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<LayoutElement>("bottom toolbar", [&](LayoutElement*, const Clay_ElementId& lId) {
CLAY(lId, {
.layout = {
.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0)}
},
.backgroundColor = convert_vec4<Clay_Color>(io.theme->backColor1),
.cornerRadius = CLAY_CORNER_RADIUS(io.theme->windowCorners1)
}) {
gui.clipping_element<ScrollArea>("tools scroll", ScrollArea::Options{
.scrollHorizontal = true,
.clipHorizontal = true,
.scrollbarX = ScrollArea::ScrollbarType::NONE,
.layoutDirection = CLAY_LEFT_TO_RIGHT,
.xAlign = CLAY_ALIGN_X_LEFT,
.yAlign = CLAY_ALIGN_Y_CENTER,
.innerContent = [&](auto&) {
bottom_toolbar_gui();
}
});
}
});
gui.element<LayoutElement>("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<Clay_Color>(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<LayoutElement>("bottom toolbar", [&](LayoutElement*, const Clay_ElementId& lId) {
CLAY(lId, {
.layout = {
.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0)}
},
.backgroundColor = convert_vec4<Clay_Color>(io.theme->backColor1),
.cornerRadius = CLAY_CORNER_RADIUS(io.theme->windowCorners1)
}) {
gui.clipping_element<ScrollArea>("tools scroll", ScrollArea::Options{
.scrollHorizontal = true,
.clipHorizontal = true,
.scrollbarX = ScrollArea::ScrollbarType::NONE,
.layoutDirection = CLAY_LEFT_TO_RIGHT,
.xAlign = CLAY_ALIGN_X_LEFT,
.yAlign = CLAY_ALIGN_Y_CENTER,
.innerContent = [&](auto&) {
bottom_toolbar_gui();
}
});
}
});
gui.element<LayoutElement>("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<Clay_Color>(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<void()> 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<Vector3f>(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<int32_t>(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<int32_t>(palette.colors.size()))
paletteColorPickerGridColorButton(newI);
else {
if(newI == static_cast<int32_t>(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<ColorPicker<Vector4f>>("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,
});
}
});
}

View file

@ -1,3 +1,21 @@
/*
* InfiniPaint
* Copyright (C) 2025-2026 Yousef Khadadeh
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "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<void()> onChange;
std::function<void()> onSelect;
std::function<void()> onDeselect;
};
struct ColorSelectorButtonData {
std::function<void()> onSelectorButtonClick;
std::function<void()> onChange;
std::function<void()> onSelect;
std::function<void()> onDeselect;
};
struct ColorPickerPopupData {
enum class ScreenType {
NORMAL,
@ -35,5 +49,26 @@ class PhoneDrawingProgramScreen : public DrawingProgramScreen {
std::string newPaletteStr;
std::set<GUIStuff::TreeListingObjIndexList> 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<void()> 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;
};

View file

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

View file

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