2
* $Id: imasel.c 14711 2008-05-06 19:29:37Z elubie $
4
* ***** BEGIN GPL LICENSE BLOCK *****
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software Foundation,
18
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21
* All rights reserved.
23
* The Original Code is: all of this file.
25
* Contributor(s): none yet.
27
* ***** END GPL LICENSE BLOCK *****
37
#include "BLI_winstuff.h"
42
#include "MEM_guardedalloc.h"
44
#include "BLI_blenlib.h"
45
#include "BLI_arithb.h"
47
#include "IMB_imbuf_types.h"
48
#include "IMB_imbuf.h"
50
#include "DNA_screen_types.h"
51
#include "DNA_space_types.h"
53
#include "BKE_utildefines.h"
54
#include "BKE_global.h"
56
#include "BIF_imasel.h"
57
#include "BIF_filelist.h"
58
#include "BIF_space.h"
59
#include "BIF_screen.h"
65
void free_imasel(SpaceImaSel *simasel)
67
/* do not free imasel itself */
69
BIF_filelist_freelib(simasel->files);
70
BIF_filelist_free(simasel->files);
71
MEM_freeN(simasel->files);
72
simasel->files = NULL;
75
IMB_freeImBuf(simasel->img);
77
if(simasel->pupmenu) {
78
MEM_freeN(simasel->pupmenu);
79
simasel->pupmenu = NULL;
83
/* resets a previous imagebrowser space type */
84
/* is used when opening an imagebrowser directly from windowtype_pupmenu,
85
since in that case we don't want any load/save/append/link action
87
void reset_imaselspace(ScrArea *sa)
89
if(sa->spacetype==SPACE_IMASEL) {
90
SpaceImaSel *simasel= sa->spacedata.first;
91
if(simasel->type==FILE_MAIN) {
93
BIF_filelist_free(simasel->files);
94
BIF_filelist_settype(simasel->files, FILE_MAIN);
98
simasel->type= FILE_UNIX;
99
BIF_filelist_settype(simasel->files, simasel->type);
102
simasel->returnfunc= NULL;
103
simasel->title[0]= 0;