Skip to content

Commit

Permalink
Add new directory type for palette database.
Browse files Browse the repository at this point in the history
Part of #2.
  • Loading branch information
fragglet committed Jul 13, 2024
1 parent 69781ac commit 72b74e9
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 15 deletions.
50 changes: 36 additions & 14 deletions src/browser/browser.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ static const struct action *dir_actions[] = {
NULL,
};

static const struct action *texture_actions[] = {
static const struct action *txt_actions[] = {
&edit_textures_action,
&rearrange_action,
&sort_entries_action,
Expand All @@ -226,7 +226,7 @@ static const struct action *texture_actions[] = {
NULL,
};

static const struct action *pnames_actions[] = {
static const struct action *pnm_actions[] = {
&edit_pnames_action,
&rearrange_action,
&sort_entries_action,
Expand All @@ -236,6 +236,10 @@ static const struct action *pnames_actions[] = {
NULL,
};

static const struct action *pal_actions[] = {
NULL,
};

static const struct action *wad_to_wad[] = {
&update_action,
&copy_action,
Expand All @@ -249,11 +253,15 @@ static const struct action *wad_to_dir[] = {
NULL,
};

static const struct action *wad_to_pnames[] = {
static const struct action *wad_to_pnm[] = {
&copy_pnames_action,
NULL,
};

static const struct action *wad_to_pal[] = {
NULL,
};

static const struct action *dir_to_wad[] = {
&update_action,
&import_action,
Expand All @@ -266,36 +274,48 @@ static const struct action *dir_to_dir[] = {
NULL,
};

static const struct action *dir_to_pnames[] = {
static const struct action *dir_to_pnm[] = {
&import_texture_config,
NULL,
};

static const struct action *dir_to_textures[] = {
static const struct action *dir_to_pal[] = {
NULL,
};

static const struct action *dir_to_txt[] = {
&import_texture_config,
NULL,
};

static const struct action *textures_to_dir[] = {
static const struct action *txt_to_dir[] = {
&export_texture_config,
NULL,
};

static const struct action *textures_to_textures[] = {
static const struct action *txt_to_txt[] = {
&copy_textures_action,
NULL,
};

static const struct action *pnames_to_pnames[] = {
static const struct action *pnm_to_pnm[] = {
&copy_pnames_action,
NULL,
};

static const struct action *pnames_to_dir[] = {
static const struct action *pnm_to_dir[] = {
&export_texture_config,
NULL,
};

static const struct action *pal_to_dir[] = {
NULL,
};

static const struct action *pal_to_wad[] = {
NULL,
};

static const struct action *no_actions[] = {NULL};

static const struct action *common_actions[] = {
Expand All @@ -317,15 +337,16 @@ static const struct action *common_actions[] = {
};

static const struct action **type_actions[NUM_DIR_FILE_TYPES] = {
dir_actions, wad_actions, texture_actions, pnames_actions,
dir_actions, wad_actions, txt_actions, pnm_actions, pal_actions,
};

static const struct action
**action_lists[NUM_DIR_FILE_TYPES][NUM_DIR_FILE_TYPES] = {
{dir_to_dir, dir_to_wad, dir_to_textures, dir_to_pnames},
{wad_to_dir, wad_to_wad, no_actions, wad_to_pnames},
{textures_to_dir, no_actions, textures_to_textures, no_actions},
{pnames_to_dir, no_actions, no_actions, pnames_to_pnames},
{dir_to_dir, dir_to_wad, dir_to_txt, dir_to_pnm, dir_to_pal},
{wad_to_dir, wad_to_wad, no_actions, wad_to_pnm, wad_to_pal},
{txt_to_dir, no_actions, txt_to_txt, no_actions, no_actions},
{pnm_to_dir, no_actions, no_actions, pnm_to_pnm, no_actions},
{pal_to_dir, pal_to_wad, no_actions, no_actions, no_actions},
};

static void AddActionList(const struct action **list, int *idx)
Expand Down Expand Up @@ -491,6 +512,7 @@ static bool DrawInfoPane(void *p)

case FILE_TYPE_TEXTURE_LIST:
case FILE_TYPE_PNAMES_LIST:
case FILE_TYPE_PALETTES:
UI_PrintMultilineString(pane->window, 1, 2, "List");
break;

Expand Down
1 change: 1 addition & 0 deletions src/fs/vfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ enum file_type {
FILE_TYPE_WAD,
FILE_TYPE_TEXTURE_LIST,
FILE_TYPE_PNAMES_LIST,
FILE_TYPE_PALETTES,
NUM_DIR_FILE_TYPES,
FILE_TYPE_FILE,
FILE_TYPE_LUMP,
Expand Down
2 changes: 1 addition & 1 deletion src/palette/palfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ struct directory *PAL_OpenDirectory(void)

pd->dir.directory_funcs = &palette_fs_functions;
VFS_InitDirectory(&pd->dir, path);
pd->dir.type = FILE_TYPE_DIR;
pd->dir.type = FILE_TYPE_PALETTES;
pd->inner = inner;

PaletteFSRefresh(pd, &pd->dir.entries, &pd->dir.num_entries);
Expand Down

0 comments on commit 72b74e9

Please sign in to comment.