4
4
* Functions to draw the "Script Window" window header
5
5
* and handle user events sent to it.
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 $
9
9
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
80
72
/* action executed after clicking in Scripts menu */
81
73
static void do_scripts_submenus(void *int_arg, int event)
83
extern int BPY_menu_do_python(short menutype, int event); // BPY_interface.c
84
75
int menutype = (int)int_arg;
86
77
BPY_menu_do_python (menutype, event);
96
87
int i = 0, menutype = (int)int_menutype;
98
if ((menutype < 0) || (menutype > PYMENU_TOTAL)) return NULL;
89
if ((menutype < 0) || (menutype > PYMENU_SCRIPTS_MENU_TOTAL))
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
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);
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)
139
//SpaceScript *sc= curarea->spacedata.first;
140
//Script *script= sc->script;
142
131
short yco = 0, menuwidth = 120;
145
134
block= uiNewBlock(&curarea->uiblocks, "script_scriptsmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
146
135
uiBlockSetButmFunc(block, do_script_scriptsmenu, NULL);
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, "");
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, "");
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");
154
145
if(curarea->headertype==HEADERTOP) {
155
146
uiBlockSetDirection(block, UI_DOWN);
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);
183
175
if(sc->menunr < 0) break;
188
178
id = (ID *)script;
202
192
allqueue(REDRAWHEADERS, 0);
197
BLI_remlink(&curarea->spacedata, sc);
198
BLI_addtail(&curarea->spacedata, sc);
199
sc = curarea->spacedata.first;
200
newspace(curarea, sc->spacetype);
248
246
uiBlockSetEmboss(block, UI_EMBOSSP);
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, "");
255
253
uiBlockSetEmboss(block, UI_EMBOSSX);
255
uiDefIconBut(block, BUT, B_SCRIPT2PREV, ICON_GO_LEFT, xco+=XIC, 0, XIC, YIC,
256
0, 0, 0, 0, 0, "Returns to previous window");
258
258
/* FULL WINDOW */
259
259
if(curarea->full)