~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/blender/src/header_script.c

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 * Functions to draw the "Script Window" window header
5
5
 * and handle user events sent to it.
6
6
 * 
7
 
 * $Id: header_script.c,v 1.6 2004/04/20 22:00:33 ton Exp $
 
7
 * $Id: header_script.c,v 1.14 2005/03/22 04:28:36 ianwill Exp $
8
8
 *
9
9
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
10
10
 *
41
41
#include <config.h>
42
42
#endif
43
43
 
44
 
#ifdef WIN32
45
 
#include "BLI_winstuff.h"
46
 
#endif
47
 
 
48
 
#include "BMF_Api.h"
49
 
#include "BIF_language.h"
50
 
#ifdef INTERNATIONAL
51
 
#include "FTF_Api.h"
52
 
#endif
 
44
#include "BLI_blenlib.h"
53
45
 
54
46
#include "BSE_headerbuttons.h"
55
47
 
80
72
/* action executed after clicking in Scripts menu */
81
73
static void do_scripts_submenus(void *int_arg, int event)
82
74
{
83
 
        extern int BPY_menu_do_python(short menutype, int event);       // BPY_interface.c
84
75
        int menutype = (int)int_arg;
85
76
 
86
77
        BPY_menu_do_python (menutype, event);
95
86
        BPyMenu *pym;
96
87
        int i = 0, menutype = (int)int_menutype;
97
88
 
98
 
        if ((menutype < 0) || (menutype > PYMENU_TOTAL)) return NULL;
 
89
        if ((menutype < 0) || (menutype > PYMENU_SCRIPTS_MENU_TOTAL))
 
90
                return NULL;
99
91
 
100
 
        block= uiNewBlock(&curarea->uiblocks, "importmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
 
92
        block= uiNewBlock(&curarea->uiblocks, "scriptsscriptssubmenus", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
101
93
        uiBlockSetButmFunc(block, do_scripts_submenus, int_menutype);
102
 
        //uiBlockSetXOfs(block, -50);  // offset to parent button
103
94
 
104
95
        for (pym = BPyMenuTable[menutype]; pym; pym = pym->next, i++) {
105
 
                uiDefBut(block, BUTM, 1, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i, pym->tooltip?pym->tooltip:pym->filename);
 
96
                uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i, pym->tooltip?pym->tooltip:pym->filename);
106
97
        }
107
98
 
108
99
        uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
136
127
/* Scripts menu */
137
128
static uiBlock *script_scriptsmenu(void *arg_unused)
138
129
{
139
 
        //SpaceScript *sc= curarea->spacedata.first;
140
 
        //Script *script= sc->script;
141
130
        uiBlock *block;
142
131
        short yco = 0, menuwidth = 120;
143
132
        int i;
145
134
        block= uiNewBlock(&curarea->uiblocks, "script_scriptsmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
146
135
        uiBlockSetButmFunc(block, do_script_scriptsmenu, NULL);
147
136
 
148
 
        for (i = 0; i < PYMENU_TOTAL; i++) {
 
137
        for (i = 0; i < PYMENU_SCRIPTS_MENU_TOTAL; i++) {
149
138
                uiDefIconTextBlockBut(block, script_scripts_submenus, (void *)i, ICON_RIGHTARROW_THIN, BPyMenu_group_itoa(i), 0, yco-=20, menuwidth, 19, "");
150
139
        }
151
140
 
152
 
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Update Menus", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "Use when you modify the scripts dir or its contents");
 
141
        uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
 
142
 
 
143
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Update Menus", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "Use when a scripts folder or its contents are modified");
153
144
 
154
145
        if(curarea->headertype==HEADERTOP) {
155
146
                uiBlockSetDirection(block, UI_DOWN);
168
159
        SpaceScript *sc= curarea->spacedata.first;
169
160
        ID *id, *idtest;
170
161
        int nr= 1;
171
 
        Script *script;
 
162
        Script *script = sc->script;
172
163
 
173
164
        if (!sc) return;
174
165
        if (sc->spacetype != SPACE_SCRIPT) return;
176
167
        switch (event) {
177
168
        case B_SCRIPTBROWSE:
178
169
                if (sc->menunr==-2) {
179
 
                        activate_databrowse((ID *)sc->script, ID_SCR, 0, B_SCRIPTBROWSE,
 
170
                        activate_databrowse((ID *)script, ID_SCR, 0, B_SCRIPTBROWSE,
180
171
                                                                                        &sc->menunr, do_script_buttons);
181
172
                        break;
182
173
                }
 
174
 
183
175
                if(sc->menunr < 0) break;
184
176
 
185
 
                script = sc->script;
186
 
 
187
177
                nr = 1;
188
178
                id = (ID *)script;
189
179
 
202
192
                        allqueue(REDRAWHEADERS, 0);
203
193
                }
204
194
                break;
 
195
        case B_SCRIPT2PREV:
 
196
                if(sc->next) {
 
197
                        BLI_remlink(&curarea->spacedata, sc);
 
198
                        BLI_addtail(&curarea->spacedata, sc);
 
199
                        sc = curarea->spacedata.first;
 
200
                        newspace(curarea, sc->spacetype);
 
201
                }
 
202
                break;
205
203
        }
206
204
 
207
205
        return;
248
246
                uiBlockSetEmboss(block, UI_EMBOSSP);
249
247
        
250
248
                xmax= GetButStringLength("Scripts");
251
 
                uiDefBlockBut(block,script_scriptsmenu, NULL, "Scripts", xco, 0, xmax, 20, "");
 
249
                uiDefPulldownBut(block,script_scriptsmenu, NULL, "Scripts", xco, 0, xmax, 20, "");
252
250
                xco+=xmax;
253
251
        }
254
252
 
255
253
        uiBlockSetEmboss(block, UI_EMBOSSX);
256
 
        xco += 10;
 
254
 
 
255
        uiDefIconBut(block, BUT, B_SCRIPT2PREV, ICON_GO_LEFT, xco+=XIC, 0, XIC, YIC,
 
256
                0, 0, 0, 0, 0, "Returns to previous window");
257
257
 
258
258
        /* FULL WINDOW */
259
259
        if(curarea->full)