refactor: Update GUI components and integrate new palette widget

- Removed references to the old `EnhancedPaletteEditor` and replaced it with the new `PaletteWidget` across various files, including canvas and context menu implementations.
- Updated CMake configurations to include the new `palette_widget` source files, ensuring proper integration into the build system.
- Refactored GUI code to enhance modularity and maintainability, improving the overall user experience in palette management and editing functionalities.
- Introduced new UI components for background rendering and editor selection dialogs, enhancing the application's graphical interface.
This commit is contained in:
scawful
2025-10-04 23:59:08 -04:00
parent bcc8f8e8f9
commit 6c0e7a96a5
21 changed files with 1536 additions and 55 deletions

View File

@@ -0,0 +1,111 @@
#ifndef YAZE_APP_EDITOR_UI_WELCOME_SCREEN_H_
#define YAZE_APP_EDITOR_UI_WELCOME_SCREEN_H_
#include <functional>
#include <string>
#include <vector>
namespace yaze {
namespace editor {
/**
* @struct RecentProject
* @brief Information about a recently used project
*/
struct RecentProject {
std::string name;
std::string filepath;
std::string rom_title;
std::string last_modified;
std::string thumbnail_path; // Optional screenshot
int days_ago = 0;
};
/**
* @class WelcomeScreen
* @brief Modern welcome screen with project grid and quick actions
*/
class WelcomeScreen {
public:
WelcomeScreen();
/**
* @brief Show the welcome screen
* @param p_open Pointer to open state
* @return True if an action was taken (ROM opened, etc.)
*/
bool Show(bool* p_open);
/**
* @brief Set callback for opening ROM
*/
void SetOpenRomCallback(std::function<void()> callback) {
open_rom_callback_ = callback;
}
/**
* @brief Set callback for creating new project
*/
void SetNewProjectCallback(std::function<void()> callback) {
new_project_callback_ = callback;
}
/**
* @brief Set callback for opening project
*/
void SetOpenProjectCallback(std::function<void(const std::string&)> callback) {
open_project_callback_ = callback;
}
/**
* @brief Refresh recent projects list from the project manager
*/
void RefreshRecentProjects();
/**
* @brief Update animation time for dynamic effects
*/
void UpdateAnimations();
/**
* @brief Check if screen should be shown
*/
bool ShouldShow() const { return !manually_closed_; }
/**
* @brief Mark as manually closed (don't show again this session)
*/
void MarkManuallyClosed() { manually_closed_ = true; }
private:
void DrawHeader();
void DrawQuickActions();
void DrawRecentProjects();
void DrawProjectCard(const RecentProject& project, int index);
void DrawTemplatesSection();
void DrawTipsSection();
void DrawWhatsNew();
std::vector<RecentProject> recent_projects_;
bool manually_closed_ = false;
// Callbacks
std::function<void()> open_rom_callback_;
std::function<void()> new_project_callback_;
std::function<void(const std::string&)> open_project_callback_;
// UI state
int selected_template_ = 0;
static constexpr int kMaxRecentProjects = 6;
// Animation state
float animation_time_ = 0.0f;
float header_glow_ = 0.0f;
float card_hover_scale_[6] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
int hovered_card_ = -1;
};
} // namespace editor
} // namespace yaze
#endif // YAZE_APP_EDITOR_UI_WELCOME_SCREEN_H_