mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-06-26 15:50:31 -04:00
Fileman icon toolbar (#975)
* Add cut/copy/paste menu with icons * Add icons, file limit to fileman
This commit is contained in:
parent
f9fdeb3419
commit
a832bd433d
16 changed files with 306 additions and 63 deletions
|
@ -42,6 +42,12 @@ enum class EmptyReason : uint8_t {
|
|||
NoSDC
|
||||
};
|
||||
|
||||
enum class ClipboardMode : uint8_t {
|
||||
None,
|
||||
Cut,
|
||||
Copy
|
||||
};
|
||||
|
||||
class FileManBaseView : public View {
|
||||
public:
|
||||
FileManBaseView(
|
||||
|
@ -56,6 +62,7 @@ public:
|
|||
|
||||
protected:
|
||||
static constexpr size_t max_filename_length = 64;
|
||||
static constexpr size_t max_items_shown = 128;
|
||||
|
||||
struct file_assoc_t {
|
||||
std::filesystem::path extension;
|
||||
|
@ -109,6 +116,12 @@ protected:
|
|||
{ 0, 2 * 8, 240, 26 * 8 },
|
||||
true
|
||||
};
|
||||
|
||||
// HACK: for item count limit.
|
||||
Text text_info {
|
||||
{ 1 * 8, 35 * 8, 15 * 8, 16 },
|
||||
""
|
||||
};
|
||||
|
||||
Button button_exit {
|
||||
{ 21 * 8, 34 * 8, 9 * 8, 32 },
|
||||
|
@ -194,13 +207,15 @@ public:
|
|||
private:
|
||||
// Passed by ref to other views needing lifetime extension.
|
||||
std::string name_buffer { };
|
||||
std::filesystem::path copy_path { };
|
||||
std::filesystem::path clipboard_path { };
|
||||
ClipboardMode clipboard_mode { ClipboardMode::None };
|
||||
|
||||
void refresh_widgets(const bool v);
|
||||
void on_rename();
|
||||
void on_delete();
|
||||
void on_new_dir();
|
||||
void on_paste();
|
||||
void on_new_dir();
|
||||
void on_new_file();
|
||||
|
||||
// True if the selected entry is a real file item.
|
||||
bool selected_is_valid() const;
|
||||
|
@ -214,29 +229,53 @@ private:
|
|||
""
|
||||
};
|
||||
|
||||
Button button_rename {
|
||||
{ 0 * 8, 29 * 8, 9 * 8, 32 },
|
||||
"Rename"
|
||||
NewButton button_rename {
|
||||
{ 0 * 8, 29 * 8, 4 * 8, 32 },
|
||||
{ },
|
||||
&bitmap_icon_rename,
|
||||
Color::dark_blue()
|
||||
};
|
||||
|
||||
Button button_delete {
|
||||
{ 21 * 4, 29 * 8, 9 * 8, 32 },
|
||||
"Delete"
|
||||
NewButton button_delete {
|
||||
{ 4 * 8, 29 * 8, 4 * 8, 32 },
|
||||
{ },
|
||||
&bitmap_icon_trash,
|
||||
Color::red()
|
||||
};
|
||||
|
||||
Button button_new_dir {
|
||||
{ 21 * 8, 29 * 8, 9 * 8, 32 },
|
||||
"New Dir"
|
||||
NewButton button_cut {
|
||||
{ 9 * 8, 29 * 8, 4 * 8, 32 },
|
||||
{ },
|
||||
&bitmap_icon_cut,
|
||||
Color::dark_grey()
|
||||
};
|
||||
|
||||
Button button_copy {
|
||||
{ 0 * 8, 34 * 8, 9 * 8, 32 },
|
||||
"Copy"
|
||||
NewButton button_copy {
|
||||
{ 13 * 8, 29 * 8, 4 * 8, 32 },
|
||||
{ },
|
||||
&bitmap_icon_copy,
|
||||
Color::dark_grey()
|
||||
};
|
||||
|
||||
Button button_paste {
|
||||
{ 21 * 4, 34 * 8, 9 * 8, 32 },
|
||||
"Paste"
|
||||
NewButton button_paste {
|
||||
{ 17 * 8, 29 * 8, 4 * 8, 32 },
|
||||
{ },
|
||||
&bitmap_icon_paste,
|
||||
Color::dark_grey()
|
||||
};
|
||||
|
||||
NewButton button_new_dir {
|
||||
{ 22 * 8, 29 * 8, 4 * 8, 32 },
|
||||
{ },
|
||||
&bitmap_icon_new_dir,
|
||||
Color::green()
|
||||
};
|
||||
|
||||
NewButton button_new_file {
|
||||
{ 26 * 8, 29 * 8, 4 * 8, 32 },
|
||||
{ },
|
||||
&bitmap_icon_new_file,
|
||||
Color::green()
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue