diff --git a/CMakeLists.txt b/CMakeLists.txt
index bdb238d..623f472 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,6 +57,7 @@ set(sources "src/main.cpp"
"src/Screens/Screen.cpp"
"src/Screens/DrawingProgramScreen.cpp"
"src/Screens/DesktopDrawingProgramScreen.cpp"
+ "src/Screens/PhoneDrawingProgramScreen.cpp"
"src/Screens/FileSelectScreen.cpp"
"src/Bookmarks/BookmarkListItem.cpp"
"src/Bookmarks/BookmarkManager.cpp"
diff --git a/assets/data/icons/RemixIcon/arrow-left-s-line.svg b/assets/data/icons/RemixIcon/arrow-left-s-line.svg
new file mode 100644
index 0000000..eb6c6cc
--- /dev/null
+++ b/assets/data/icons/RemixIcon/arrow-left-s-line.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/Screens/FileSelectScreen.cpp b/src/Screens/FileSelectScreen.cpp
index aa8da57..338b327 100644
--- a/src/Screens/FileSelectScreen.cpp
+++ b/src/Screens/FileSelectScreen.cpp
@@ -13,7 +13,7 @@
#include "../GUIStuff/Elements/PositionAdjustingPopupMenu.hpp"
#include "../World.hpp"
#include "Helpers/StringHelpers.hpp"
-#include "DrawingProgramScreen.hpp"
+#include "PhoneDrawingProgramScreen.hpp"
#include
#include
@@ -157,6 +157,8 @@ void FileSelectScreen::main_display() {
switch(selectedMenu) {
case SelectedMenu::FILES:
file_view();
+ if(!editMode)
+ create_file_button();
break;
case SelectedMenu::TRASH:
file_view();
@@ -171,6 +173,35 @@ void FileSelectScreen::main_display() {
}
}
+void FileSelectScreen::create_file_button() {
+ auto& gui = main.g.gui;
+ gui.set_z_index(gui.get_z_index() + 2, [&] {
+ gui.element("create file button floating area", [&](LayoutElement*, const Clay_ElementId& lId) {
+ CLAY(lId, {
+ .layout = {.sizing = {.width = CLAY_SIZING_FIT(0), .height = CLAY_SIZING_FIT(0)}},
+ .floating = {
+ .offset = {-5, -5},
+ .zIndex = gui.get_z_index(),
+ .attachPoints = {
+ .element = CLAY_ATTACH_POINT_RIGHT_BOTTOM,
+ .parent = CLAY_ATTACH_POINT_RIGHT_BOTTOM
+ },
+ .attachTo = CLAY_ATTACH_TO_PARENT
+ }
+ }) {
+ svg_icon_button(gui, "add button", "data/icons/plus.svg", {
+ .onClick = [&] {
+ main.create_new_tab({
+ .isClient = false
+ });
+ main.screen = std::make_unique(main);
+ }
+ });
+ }
+ });
+ });
+}
+
void FileSelectScreen::edit_action_bar_button(const char* id, const std::string& svgPath, const char* text, const std::function& onClick) {
auto& gui = main.g.gui;
CLAY_AUTO_ID({
@@ -664,7 +695,7 @@ void FileSelectScreen::start_edit_mode() {
void FileSelectScreen::input_open_infinipaint_file_callback(const CustomEvents::OpenInfiniPaintFileEvent& openFile) {
main.create_new_tab(openFile);
- main.screen = std::make_unique(main);
+ main.screen = std::make_unique(main);
}
void FileSelectScreen::draw(SkCanvas* canvas) {
diff --git a/src/Screens/FileSelectScreen.hpp b/src/Screens/FileSelectScreen.hpp
index b8d0cec..22e2669 100644
--- a/src/Screens/FileSelectScreen.hpp
+++ b/src/Screens/FileSelectScreen.hpp
@@ -43,6 +43,7 @@ class FileSelectScreen : public Screen {
void main_display();
void main_menu();
void file_view();
+ void create_file_button();
void file_view_edit();
void menu_black_box();
void edit_action_bar();
diff --git a/src/Screens/PhoneDrawingProgramScreen.cpp b/src/Screens/PhoneDrawingProgramScreen.cpp
new file mode 100644
index 0000000..ab4469f
--- /dev/null
+++ b/src/Screens/PhoneDrawingProgramScreen.cpp
@@ -0,0 +1,56 @@
+#include "PhoneDrawingProgramScreen.hpp"
+#include "../MainProgram.hpp"
+#include "DrawingProgramScreen.hpp"
+#include "Helpers/ConvertVec.hpp"
+#include "../GUIStuff/Elements/LayoutElement.hpp"
+#include "../GUIStuff/ElementHelpers/ButtonHelpers.hpp"
+#include "FileSelectScreen.hpp"
+
+using namespace GUIStuff;
+using namespace ElementHelpers;
+
+PhoneDrawingProgramScreen::PhoneDrawingProgramScreen(MainProgram& m):
+ DrawingProgramScreen(m)
+{}
+
+void PhoneDrawingProgramScreen::update() {
+ DrawingProgramScreen::update();
+}
+
+void PhoneDrawingProgramScreen::gui_layout_run() {
+ main_display();
+}
+
+void PhoneDrawingProgramScreen::main_display() {
+ auto& gui = main.g.gui;
+ auto& io = gui.io;
+ CLAY_AUTO_ID({
+ .layout = {
+ .sizing = { .width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_GROW(0) },
+ .layoutDirection = CLAY_TOP_TO_BOTTOM
+ },
+ }) {
+ gui.element("top toolbar", [&](LayoutElement* l, const Clay_ElementId& lId) {
+ CLAY(lId, {
+ .layout = {
+ .sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(0) },
+ .childAlignment = { .x = CLAY_ALIGN_X_LEFT, .y = CLAY_ALIGN_Y_CENTER},
+ .layoutDirection = CLAY_LEFT_TO_RIGHT
+ },
+ .backgroundColor = convert_vec4(io.theme->backColor0),
+ .border = {
+ .color = convert_vec4(io.theme->frontColor1),
+ .width = {.bottom = 1}
+ }
+ }) {
+ svg_icon_button(gui, "back exit button", "data/icons/RemixIcon/arrow-left-s-line.svg", {
+ .drawType = SelectableButton::DrawType::TRANSPARENT_ALL,
+ .onClick = [&] {
+ main.set_tab_to_close(main.world.get());
+ main.screen = std::make_unique(main);
+ }
+ });
+ }
+ });
+ }
+}
diff --git a/src/Screens/PhoneDrawingProgramScreen.hpp b/src/Screens/PhoneDrawingProgramScreen.hpp
new file mode 100644
index 0000000..cd89f26
--- /dev/null
+++ b/src/Screens/PhoneDrawingProgramScreen.hpp
@@ -0,0 +1,12 @@
+#pragma once
+#include "DrawingProgramScreen.hpp"
+#include "../Toolbar.hpp"
+
+class PhoneDrawingProgramScreen : public DrawingProgramScreen {
+ public:
+ PhoneDrawingProgramScreen(MainProgram& m);
+ virtual void update() override;
+ virtual void gui_layout_run() override;
+ private:
+ void main_display();
+};
diff --git a/src/main.cpp b/src/main.cpp
index 435d252..98ca7fc 100755
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -4,6 +4,7 @@
#include "Helpers/FileDownloader.hpp"
#include "Screens/FileSelectScreen.hpp"
#include "Screens/DesktopDrawingProgramScreen.hpp"
+#include "Screens/PhoneDrawingProgramScreen.hpp"
#include "VersionConstants.hpp"
#include "include/gpu/GpuTypes.h"
#include
@@ -525,6 +526,8 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) {
mS.m->window.canCreateSurfaces = true;
resize_window(mS);
+ mS.m->screen = std::make_unique(*mS.m);
+
if(listOfFilesToOpenFromCommand.empty()) {
mS.m->create_new_tab({
.isClient = false
@@ -539,8 +542,6 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) {
}
}
- mS.m->screen = std::make_unique(*mS.m);
-
mS.m->update(); // Run update once to make sure that callbacks dont crash
#ifdef NDEBUG