== bugfix ==
authorAndrea Weikert <elubie@gmx.net>
Tue, 6 May 2008 19:29:37 +0000 (19:29 +0000)
committerAndrea Weikert <elubie@gmx.net>
Tue, 6 May 2008 19:29:37 +0000 (19:29 +0000)
[#10312] Append Link (image browser) bug if combined with Open window
The only place where the special handling in newspace is relevenant is when
opening it with the windowtype_pupmenu. All other overlaying windows( render in image space, scriptspace)
should leave imagebrowser/filebrowser space alone.

source/blender/include/BIF_imasel.h
source/blender/include/BSE_filesel.h
source/blender/src/filesel.c
source/blender/src/headerbuttons.c
source/blender/src/imasel.c
source/blender/src/space.c

index a3a3b7531d6bdffa14e6556444df08b3997d679b..cbd547602e1af124a0b586e1d0d9a94e23aefad1 100644 (file)
@@ -34,6 +34,7 @@ struct ScrArea;
 struct ID;
 
 void free_imasel(struct SpaceImaSel *simasel);
+void reset_imaselspace(struct ScrArea *sa);
 
 void clever_numbuts_imasel(void);
 
index 13e38d50c4763943d765502c733eee37ff602770..b46b2328ea46daa8411c370dc17e749aa2752817 100644 (file)
@@ -54,6 +54,7 @@ void activate_databrowse(struct ID *id, int idcode, int fromcode, int retval, sh
 void activate_databrowse_args(struct ID *id, int idcode, int fromcode, short *menup, void (*func)(char *, void *, void *), void *arg1, void *arg2);
 
 void filesel_prevspace(void);
+void reset_filespace(struct ScrArea *sa);
 void free_filesel_spec(char *dir);
 void winqreadfilespace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
 void main_to_filelist(struct SpaceFile *sfile);   
index 19372dcbee621fa25217b3d00ab939811b041d2d..bfff2f10ab6d5456075a7eaaf3a2ee1a42a1728e 100644 (file)
@@ -1299,6 +1299,27 @@ void activate_databrowse_args(struct ID *id, int idcode, int fromcode, short *me
        sfile->ipotype= fromcode;
 }
 
+/* resets a previous file space type */
+/* is used when opening a filebrowser directly from windowtype_pupmenu,
+   since in that case we don't want any load/save/append/link action
+*/
+void reset_filespace(ScrArea *sa)
+{
+       if (sa->spacetype == SPACE_FILE) {
+               SpaceFile *sfile= sa->spacedata.first;
+                       
+               if(sfile->type==FILE_MAIN) {
+                       freefilelist(sfile);
+               } else {
+                       sfile->type= FILE_UNIX;
+               }
+               
+               sfile->returnfunc= NULL;
+               sfile->title[0]= 0;
+               if(sfile->filelist) test_flags_file(sfile);
+       }
+}
+
 void filesel_prevspace()
 {
        SpaceFile *sfile= curarea->spacedata.first;
index b91a8f74f806e36fc26a12f681cf3833a35e48f0..81ad135f5146670b18fea4f297909dad5429309d 100644 (file)
@@ -1434,6 +1434,8 @@ void do_global_buttons(unsigned short event)
                break;
        case B_NEWSPACE:
                newspace(curarea, curarea->butspacetype);
+               reset_filespace(curarea);
+               reset_imaselspace(curarea);
                break;
        case B_LOADTEMP:        /* is button from space.c */
                BIF_read_autosavefile();
index be9f489ea49c6a6794efef69aa2675c8e97adc2f..f502445d3296d4ee86c23ab7df3265fb56d626c3 100644 (file)
@@ -80,3 +80,26 @@ void free_imasel(SpaceImaSel *simasel)
        }
 }
 
+/* resets a previous imagebrowser space type */
+/* is used when opening an imagebrowser directly from windowtype_pupmenu,
+   since in that case we don't want any load/save/append/link action
+*/
+void reset_imaselspace(ScrArea *sa) 
+{
+       if(sa->spacetype==SPACE_IMASEL) {
+               SpaceImaSel *simasel= sa->spacedata.first;
+               if(simasel->type==FILE_MAIN) {
+                       if (simasel->files) {
+                               BIF_filelist_free(simasel->files);
+                               BIF_filelist_settype(simasel->files, FILE_MAIN);
+                       }
+               } else {
+                       if (simasel->files) {
+                               simasel->type= FILE_UNIX;
+                               BIF_filelist_settype(simasel->files, simasel->type);
+                       }
+               }
+               simasel->returnfunc= NULL;
+               simasel->title[0]= 0;
+       }
+}
index 41e539c3d1ad85cb16cc060d03eb06763e0acef2..3cffed48224962076eb071fba852db342c78b69b 100644 (file)
@@ -5611,6 +5611,7 @@ static void init_imaselspace(ScrArea *sa)
        simasel->files = BIF_filelist_new();
 }
 
+
 /* ******************** SPACE: OOPS ********************** */
 
 extern void drawoopsspace(ScrArea *sa, void *spacedata);
@@ -6155,39 +6156,7 @@ void newspace(ScrArea *sa, int type)
                }
        }
 
-               
-       /* exception: filespace */
-       if(sa->spacetype==SPACE_FILE) {
-               SpaceFile *sfile= sa->spacedata.first;
-               
-               if(sfile->type==FILE_MAIN) {
-                       freefilelist(sfile);
-               } else {
-                       sfile->type= FILE_UNIX;
-               }
-               
-               sfile->returnfunc= NULL;
-               sfile->title[0]= 0;
-               if(sfile->filelist) test_flags_file(sfile);
-       }
-       /* exception: imasel space */
-       else if(sa->spacetype==SPACE_IMASEL) {
-               SpaceImaSel *simasel= sa->spacedata.first;
-               if(simasel->type==FILE_MAIN) {
-                       if (simasel->files) {
-                               BIF_filelist_free(simasel->files);
-                               BIF_filelist_settype(simasel->files, FILE_MAIN);
-                       }
-               } else {
-                       if (simasel->files) {
-                               simasel->type= FILE_UNIX;
-                               BIF_filelist_settype(simasel->files, simasel->type);
-                       }
-               }
-               simasel->returnfunc= NULL;
-               simasel->title[0]= 0;
-       }
-       else if(sa->spacetype==SPACE_OOPS) {
+       if(sa->spacetype==SPACE_OOPS) {
                SpaceOops *so= sa->spacedata.first;
                if(xtra && so->type!=SO_OUTLINER) {
                        so->type= SO_OUTLINER;