From 41aac13d9eb1c39f34b2b8471f349471ee2f0f5b Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 18 Mar 2007 03:30:24 +0000 Subject: == Recently-Opened Files List (Patch #5708) == In the past, this was limited to only having 10 items. Now you can set the number of recently opened files that are remembered (ranging from 0 to 30 items). Setting for this can be found under 'Auto-Save' in the Info window. --- source/blender/makesdna/DNA_userdef_types.h | 2 +- source/blender/src/header_info.c | 2 +- source/blender/src/space.c | 5 +++++ source/blender/src/toets.c | 2 +- source/blender/src/usiblender.c | 8 ++++++-- 5 files changed, 14 insertions(+), 5 deletions(-) (limited to 'source') diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index b83568def5d..d486f8eae5f 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -178,7 +178,7 @@ typedef struct UserDef { short rvibright; /* rotating view icon brightness */ char versemaster[160]; char verseuser[160]; - short pad; + short recent_files; /* maximum number of recently used files to remember */ } UserDef; extern UserDef U; /* from usiblender.c !!!! */ diff --git a/source/blender/src/header_info.c b/source/blender/src/header_info.c index ed4d2a546b4..b948dbc921c 100644 --- a/source/blender/src/header_info.c +++ b/source/blender/src/header_info.c @@ -924,7 +924,7 @@ static uiBlock *info_openrecentmenu(void *arg_unused) menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); } - for (recent = G.recent_files.first, i=0; i<10 && recent; recent = recent->next, i++) { + for (recent = G.recent_files.first, i=0; inext, i++) { if (strcmp(recent->filename, G.sce)!=0) { uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, recent->filename, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i+1, ""); diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 710c7b55bc2..38d2cbb3dd2 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -3515,6 +3515,11 @@ void drawinfospace(ScrArea *sa, void *spacedata) 0, 0, 0, 0, 0,"Open the most recently saved temporary file"); } + uiDefButS(block, NUM, B_DRAWINFO, "Recent Files:", + (xpos+edgsp+(2*mpref)+(3*midsp)),y3,(mpref),buth, + &U.recent_files, 0, 30, 0, 0, + "Maximum number of recently opened files to remember"); + } else if (U.userpref == 4) { /* system & opengl */ uiDefBut(block, LABEL,0,"Solid OpenGL lights:", diff --git a/source/blender/src/toets.c b/source/blender/src/toets.c index dbbe97fbe20..04b21d32203 100644 --- a/source/blender/src/toets.c +++ b/source/blender/src/toets.c @@ -377,7 +377,7 @@ char *recent_filelist(void) ofs = 1; } else ofs = 0; - for (recent = G.recent_files.first, i=0; (i<10) && (recent); recent = recent->next, i++) { + for (recent = G.recent_files.first, i=0; (inext, i++) { if (strcmp(recent->filename, G.sce)) { p+= sprintf(p, "|%s %%x%d", recent->filename, i+ofs+1); } diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c index 140e97d4028..b81cba7d1d0 100644 --- a/source/blender/src/usiblender.c +++ b/source/blender/src/usiblender.c @@ -353,6 +353,10 @@ static void init_userdef_file(void) } } } + if (G.main->versionfile <= 243) { + /* set default number of recently-used files (if not set) */ + if (U.recent_files == 0) U.recent_files = 10; + } /* GL Texture Garbage Collection (variable abused above!) */ if (U.textimeout == 0) { @@ -567,7 +571,7 @@ static void readBlog(void) G.recent_files.first = G.recent_files.last = NULL; /* read list of recent opend files from .Blog to memory */ - for (l= lines, num= 0; l && (num<10); l= l->next, num++) { + for (l= lines, num= 0; l && (numnext, num++) { line = l->link; if (!BLI_streq(line, "")) { if (num==0) @@ -666,7 +670,7 @@ static void writeBlog(void) recent = recent->next; i=1; /* write rest of recent opened files to .Blog */ - while((i<10) && (recent)){ + while((ifilename, G.sce)!=0) { fprintf(fp, "%s\n", recent->filename); -- cgit v1.2.3