diff options
author | Andrea Weikert <elubie@gmx.net> | 2009-01-06 17:42:54 +0300 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2009-01-06 17:42:54 +0300 |
commit | b1cb844e0539376cb41cd15bf802aea62848b90a (patch) | |
tree | 5e67be9915d4a76afd9e894cc2e0783d439c41be /source/blender/editors/space_file/fsmenu.c | |
parent | 10e6566aebec1c1c623cd88c3887db7c113d5af9 (diff) |
2.5 - Start of filebrowser.
- basic drawing of list and thumbnail view (switchable through 'favourits' icon in header)
- selection of files and directories (bookmarks) works with the RMB (right mouse button)
- load operator for files still unstable (no check for correct file type) and incomplete. (WM_operator_free missing)
immediate TODOS:
- fix load file operator
- finish drawing of buttons in header
- drawing of detailed list with all file info.
- finish selection and execute operators (LMB and MMB execute)
later todos:
- parent dir
- keymap for all the shortcuts
- append/link and databrowse
- ...
Diffstat (limited to 'source/blender/editors/space_file/fsmenu.c')
-rw-r--r-- | source/blender/editors/space_file/fsmenu.c | 67 |
1 files changed, 65 insertions, 2 deletions
diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index da363cf4071..b4b2688ed7b 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -22,13 +22,14 @@ * * The Original Code is: all of this file. * - * Contributor(s): none yet. + * Contributor(s): Andrea Weikert (c) 2008 Blender Foundation. * * ***** END GPL LICENSE BLOCK ***** */ #include <stdlib.h> #include <string.h> +#include <stdio.h> #include <math.h> #include "MEM_guardedalloc.h" @@ -37,6 +38,14 @@ #include "BLI_linklist.h" #include "BLI_dynstr.h" +#ifdef WIN32 +#include <windows.h> /* need to include windows.h so _WIN32_IE is defined */ +#ifndef _WIN32_IE +#define _WIN32_IE 0x0400 /* minimal requirements for SHGetSpecialFolderPath on MINGW MSVC has this defined already */ +#endif +#include <shlobj.h> /* for SHGetSpecialFolderPath, has to be done before BLI_winstuff because 'near' is disabled through BLI_windstuff */ +#include "BLI_winstuff.h" +#endif #include "fsmenu.h" /* include ourselves */ @@ -64,7 +73,7 @@ int fsmenu_get_nentries(void) return count; } -int fsmenu_is_entry_a_seperator(int idx) +int fsmenu_is_entry_a_separator(int idx) { FSMenuEntry *fsme; @@ -233,6 +242,60 @@ void fsmenu_write_file(const char *filename) fclose(fp); } +void fsmenu_read_file(const char *filename) +{ + char line[256]; + FILE *fp; + + #ifdef WIN32 + /* Add the drive names to the listing */ + { + __int64 tmp; + char folder[256]; + char tmps[4]; + int i; + + tmp= GetLogicalDrives(); + + for (i=2; i < 26; i++) { + if ((tmp>>i) & 1) { + tmps[0]='a'+i; + tmps[1]=':'; + tmps[2]='\\'; + tmps[3]=0; + + fsmenu_insert_entry(tmps, 0, 0); + } + } + + /* Adding Desktop and My Documents */ + fsmenu_append_separator(); + + SHGetSpecialFolderPath(0, folder, CSIDL_PERSONAL, 0); + fsmenu_insert_entry(folder, 0, 0); + SHGetSpecialFolderPath(0, folder, CSIDL_DESKTOPDIRECTORY, 0); + fsmenu_insert_entry(folder, 0, 0); + + fsmenu_append_separator(); + } +#endif + + fp = fopen(filename, "w"); + if (!fp) return; + + while ( fgets ( line, 256, fp ) != NULL ) /* read a line */ + { + int len = strlen(line); + if (len>0) { + if (line[len-1] == '\n') { + line[len-1] = '\0'; + } + fsmenu_insert_entry(line, 0, 1); + } + } + fclose(fp); +} + void fsmenu_free(void) { FSMenuEntry *fsme= fsmenu; |