Blender V2.61 - r43446
Classes | Typedefs | Functions | Variables

fsmenu.c File Reference

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include "MEM_guardedalloc.h"
#include "DNA_space_types.h"
#include "BLI_blenlib.h"
#include "BLI_linklist.h"
#include "BLI_dynstr.h"
#include "fsmenu.h"

Go to the source code of this file.

Classes

struct  _FSMenuEntry
struct  FSMenu

Typedefs

typedef struct _FSMenuEntry FSMenuEntry
typedef struct FSMenu FSMenu

Functions

struct FSMenufsmenu_get (void)
static FSMenuEntryfsmenu_get_category (struct FSMenu *fsmenu, FSMenuCategory category)
static void fsmenu_set_category (struct FSMenu *fsmenu, FSMenuCategory category, FSMenuEntry *fsms)
int fsmenu_get_nentries (struct FSMenu *fsmenu, FSMenuCategory category)
char * fsmenu_get_entry (struct FSMenu *fsmenu, FSMenuCategory category, int idx)
short fsmenu_can_save (struct FSMenu *fsmenu, FSMenuCategory category, int idx)
void fsmenu_insert_entry (struct FSMenu *fsmenu, FSMenuCategory category, const char *path, int sorted, short save)
void fsmenu_remove_entry (struct FSMenu *fsmenu, FSMenuCategory category, int idx)
void fsmenu_write_file (struct FSMenu *fsmenu, const char *filename)
void fsmenu_read_bookmarks (struct FSMenu *fsmenu, const char *filename)
void fsmenu_read_system (struct FSMenu *fsmenu)
static void fsmenu_free_category (struct FSMenu *fsmenu, FSMenuCategory category)
void fsmenu_free (struct FSMenu *fsmenu)

Variables

static FSMenug_fsmenu = NULL

Detailed Description

Definition in file fsmenu.c.


Typedef Documentation

typedef struct FSMenu FSMenu
typedef struct _FSMenuEntry FSMenuEntry

Definition at line 72 of file fsmenu.c.


Function Documentation

short fsmenu_can_save ( struct FSMenu fsmenu,
FSMenuCategory  category,
int  index 
)

Return whether the entry was created by the user and can be saved and deleted

Definition at line 152 of file fsmenu.c.

References fsmenu_get_category(), _FSMenuEntry::next, and _FSMenuEntry::save.

Referenced by file_panel_category().

void fsmenu_free ( struct FSMenu fsmenu)

Free's all the memory associated with the fsmenu

Definition at line 534 of file fsmenu.c.

References FS_CATEGORY_BOOKMARKS, FS_CATEGORY_RECENT, FS_CATEGORY_SYSTEM, fsmenu_free_category(), and MEM_freeN().

Referenced by ED_file_exit().

static void fsmenu_free_category ( struct FSMenu fsmenu,
FSMenuCategory  category 
) [static]

Definition at line 520 of file fsmenu.c.

References fsmenu_get_category(), MEM_freeN(), _FSMenuEntry::next, and _FSMenuEntry::path.

Referenced by fsmenu_free().

struct FSMenu* fsmenu_get ( void  ) [read]
static FSMenuEntry* fsmenu_get_category ( struct FSMenu fsmenu,
FSMenuCategory  category 
) [static]
char* fsmenu_get_entry ( struct FSMenu fsmenu,
FSMenuCategory  category,
int  index 
)

Returns the fsmenu entry at index (or NULL if a bad index) or a separator.

Definition at line 142 of file fsmenu.c.

References fsmenu_get_category(), _FSMenuEntry::next, NULL, and _FSMenuEntry::path.

Referenced by file_panel_category().

int fsmenu_get_nentries ( struct FSMenu fsmenu,
FSMenuCategory  category 
)

Returns the number of entries in the Fileselect Menu

Definition at line 131 of file fsmenu.c.

References fsmenu_get_category(), and _FSMenuEntry::next.

Referenced by bookmark_delete_exec(), file_panel_category(), and fsmenu_write_file().

void fsmenu_insert_entry ( struct FSMenu fsmenu,
FSMenuCategory  category,
const char *  path,
int  sorted,
short  save 
)

Inserts a new fsmenu entry with the given path. Duplicate entries are not added.

Parameters:
sortedShould entry be inserted in sorted order?

Definition at line 162 of file fsmenu.c.

References BLI_path_cmp, BLI_strdup(), fsmenu_get_category(), fsmenu_set_category(), MEM_mallocN(), and _FSMenuEntry::next.

Referenced by bookmark_add_exec(), file_exec(), fsmenu_read_bookmarks(), and fsmenu_read_system().

void fsmenu_read_bookmarks ( struct FSMenu fsmenu,
const char *  filename 
)

reads the 'bookmarks' from the specified file

Definition at line 258 of file fsmenu.c.

References BLI_exists(), FS_CATEGORY_BOOKMARKS, FS_CATEGORY_RECENT, fsmenu_insert_entry(), len(), NULL, and strlen().

Referenced by ED_file_init().

void fsmenu_read_system ( struct FSMenu fsmenu)

adds system specific directories

Definition at line 288 of file fsmenu.c.

References BLI_exists(), BLI_snprintf(), err, FILE_MAX, FILE_MAXDIR, FS_CATEGORY_BOOKMARKS, FS_CATEGORY_SYSTEM, fsmenu_insert_entry(), i, len(), NULL, and strlen().

Referenced by ED_file_init().

void fsmenu_remove_entry ( struct FSMenu fsmenu,
FSMenuCategory  category,
int  index 
)

Removes the fsmenu entry at the given index.

Definition at line 203 of file fsmenu.c.

References fsmenu_get_category(), fsmenu_set_category(), MEM_freeN(), _FSMenuEntry::next, and NULL.

Referenced by bookmark_delete_exec().

static void fsmenu_set_category ( struct FSMenu fsmenu,
FSMenuCategory  category,
FSMenuEntry fsms 
) [static]
void fsmenu_write_file ( struct FSMenu fsmenu,
const char *  filename 
)

Variable Documentation

FSMenu* g_fsmenu = NULL [static]

Definition at line 88 of file fsmenu.c.

Referenced by fsmenu_get().