[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18969] branches/blender2.5/blender/source /blender/editors: 2.5
Ton Roosendaal
ton at blender.org
Sat Feb 14 15:25:49 CET 2009
Revision: 18969
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18969
Author: ton
Date: 2009-02-14 15:25:48 +0100 (Sat, 14 Feb 2009)
Log Message:
-----------
2.5
FileWindow:
It appeared all load/save went via 1 call, so the 'OK save over' menu
popped up on loading files too.
Added check in the function for saving... bit weak, could become an
argument for ED_fileselect.
Also renamed file operators to conform to others.
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c
branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c
branches/blender2.5/blender/source/blender/editors/space_file/file_intern.h
branches/blender2.5/blender/source/blender/editors/space_file/file_ops.c
branches/blender2.5/blender/source/blender/editors/space_file/space_file.c
Modified: branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c 2009-02-14 13:18:18 UTC (rev 18968)
+++ branches/blender2.5/blender/source/blender/editors/screen/screen_ops.c 2009-02-14 14:25:48 UTC (rev 18969)
@@ -2307,8 +2307,8 @@
WM_keymap_verify_item(keymap, "SCREEN_OT_redo_last", F6KEY, KM_PRESS, 0, 0);
/* files */
- WM_keymap_add_item(keymap, "ED_FILE_OT_load", RETKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "ED_FILE_OT_cancel", ESCKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "FILE_OT_exec", RETKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "FILE_OT_cancel", ESCKEY, KM_PRESS, 0, 0);
/* undo */
WM_keymap_add_item(keymap, "ED_OT_undo", ZKEY, KM_PRESS, KM_CTRL, 0);
Modified: branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c 2009-02-14 13:18:18 UTC (rev 18968)
+++ branches/blender2.5/blender/source/blender/editors/space_file/file_draw.c 2009-02-14 14:25:48 UTC (rev 18969)
@@ -83,7 +83,7 @@
/* button events */
enum {
B_REDR = 0,
- B_FS_LOAD,
+ B_FS_EXEC,
B_FS_CANCEL,
B_FS_PARENT,
} eFile_ButEvents;
@@ -91,8 +91,8 @@
static void do_file_buttons(bContext *C, void *arg, int event)
{
switch(event) {
- case B_FS_LOAD:
- file_load_exec(C, NULL); /* file_ops.c */
+ case B_FS_EXEC:
+ file_exec(C, NULL); /* file_ops.c */
break;
case B_FS_CANCEL:
file_cancel_exec(C, NULL); /* file_ops.c */
@@ -158,7 +158,7 @@
if(loadbutton) {
uiSetCurFont(block, UI_HELV);
- uiDefBut(block, BUT, B_FS_LOAD, params->title, xmax-loadbutton, filebuty2, loadbutton, 21, params->dir, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
+ uiDefBut(block, BUT, B_FS_EXEC, params->title, xmax-loadbutton, filebuty2, loadbutton, 21, params->dir, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
uiDefBut(block, BUT, B_FS_CANCEL, "Cancel", xmax-loadbutton, filebuty1, loadbutton, 21, params->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, "");
}
Modified: branches/blender2.5/blender/source/blender/editors/space_file/file_intern.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_file/file_intern.h 2009-02-14 13:18:18 UTC (rev 18968)
+++ branches/blender2.5/blender/source/blender/editors/space_file/file_intern.h 2009-02-14 14:25:48 UTC (rev 18969)
@@ -49,17 +49,17 @@
struct wmOperatorType;
struct wmOperator;
struct wmEvent;
-void ED_FILE_OT_highlight(struct wmOperatorType *ot);
-void ED_FILE_OT_select(struct wmOperatorType *ot);
-void ED_FILE_OT_select_all(struct wmOperatorType *ot);
-void ED_FILE_OT_border_select(struct wmOperatorType *ot);
-void ED_FILE_OT_select_bookmark(struct wmOperatorType *ot);
-void ED_FILE_OT_loadimages(struct wmOperatorType *ot);
-void ED_FILE_OT_load(struct wmOperatorType *ot);
-void ED_FILE_OT_cancel(struct wmOperatorType *ot);
-void ED_FILE_OT_parent(struct wmOperatorType *ot);
+void FILE_OT_highlight(struct wmOperatorType *ot);
+void FILE_OT_select(struct wmOperatorType *ot);
+void FILE_OT_select_all(struct wmOperatorType *ot);
+void FILE_OT_border_select(struct wmOperatorType *ot);
+void FILE_OT_select_bookmark(struct wmOperatorType *ot);
+void FILE_OT_loadimages(struct wmOperatorType *ot);
+void FILE_OT_exec(struct wmOperatorType *ot);
+void FILE_OT_cancel(struct wmOperatorType *ot);
+void FILE_OT_parent(struct wmOperatorType *ot);
-int file_load_exec(bContext *C, struct wmOperator *unused);
+int file_exec(bContext *C, struct wmOperator *unused);
int file_cancel_exec(bContext *C, struct wmOperator *unused);
int file_parent_exec(bContext *C, struct wmOperator *unused);
int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my);
Modified: branches/blender2.5/blender/source/blender/editors/space_file/file_ops.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_file/file_ops.c 2009-02-14 13:18:18 UTC (rev 18968)
+++ branches/blender2.5/blender/source/blender/editors/space_file/file_ops.c 2009-02-14 14:25:48 UTC (rev 18969)
@@ -220,11 +220,11 @@
return OPERATOR_FINISHED;
}
-void ED_FILE_OT_border_select(wmOperatorType *ot)
+void FILE_OT_border_select(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Activate/Select File";
- ot->idname= "ED_FILE_OT_border_select";
+ ot->idname= "FILE_OT_border_select";
/* api callbacks */
ot->invoke= WM_border_select_invoke;
@@ -259,11 +259,11 @@
return OPERATOR_FINISHED;
}
-void ED_FILE_OT_select(wmOperatorType *ot)
+void FILE_OT_select(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Activate/Select File";
- ot->idname= "ED_FILE_OT_select";
+ ot->idname= "FILE_OT_select";
/* api callbacks */
ot->invoke= file_select_invoke;
@@ -303,11 +303,11 @@
return OPERATOR_FINISHED;
}
-void ED_FILE_OT_select_all(wmOperatorType *ot)
+void FILE_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Select/Deselect all files";
- ot->idname= "ED_FILE_OT_select_all";
+ ot->idname= "FILE_OT_select_all";
/* api callbacks */
ot->invoke= file_select_all_invoke;
@@ -369,11 +369,11 @@
return OPERATOR_FINISHED;
}
-void ED_FILE_OT_select_bookmark(wmOperatorType *ot)
+void FILE_OT_select_bookmark(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Select Directory";
- ot->idname= "ED_FILE_OT_select_bookmark";
+ ot->idname= "FILE_OT_select_bookmark";
/* api callbacks */
ot->invoke= bookmark_select_invoke;
@@ -394,12 +394,12 @@
return OPERATOR_FINISHED;
}
-void ED_FILE_OT_loadimages(wmOperatorType *ot)
+void FILE_OT_loadimages(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Load Images";
- ot->idname= "ED_FILE_OT_loadimages";
+ ot->idname= "FILE_OT_loadimages";
/* api callbacks */
ot->invoke= loadimages_invoke;
@@ -442,11 +442,11 @@
return OPERATOR_FINISHED;
}
-void ED_FILE_OT_highlight(struct wmOperatorType *ot)
+void FILE_OT_highlight(struct wmOperatorType *ot)
{
/* identifiers */
ot->name= "Highlight File";
- ot->idname= "ED_FILE_OT_highlight";
+ ot->idname= "FILE_OT_highlight";
/* api callbacks */
ot->invoke= file_highlight_invoke;
@@ -466,11 +466,11 @@
return OPERATOR_FINISHED;
}
-void ED_FILE_OT_cancel(struct wmOperatorType *ot)
+void FILE_OT_cancel(struct wmOperatorType *ot)
{
/* identifiers */
ot->name= "Cancel File Load";
- ot->idname= "ED_FILE_OT_cancel";
+ ot->idname= "FILE_OT_cancel";
/* api callbacks */
ot->exec= file_cancel_exec;
@@ -478,7 +478,7 @@
}
-int file_load_exec(bContext *C, wmOperator *unused)
+int file_exec(bContext *C, wmOperator *unused)
{
SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
char name[FILE_MAX];
@@ -496,24 +496,32 @@
strcat(name, sfile->params->file);
RNA_string_set(op->ptr, "filename", name);
- /* this gives ownership to pupmenu */
- uiPupMenuSaveOver(C, op, name);
+ /* a bit weak, might become arg for ED_fileselect? */
+ if(strncmp(sfile->params->title, "Save", 4)==0) {
+ /* this gives ownership to pupmenu */
+ uiPupMenuSaveOver(C, op, name);
+ }
+ else {
+ op->type->exec(C, op);
+ WM_operator_free(op);
+ }
}
-
+
return OPERATOR_FINISHED;
}
-void ED_FILE_OT_load(struct wmOperatorType *ot)
+void FILE_OT_exec(struct wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Load File";
- ot->idname= "ED_FILE_OT_load";
+ ot->name= "Execute File Window";
+ ot->idname= "FILE_OT_exec";
/* api callbacks */
- ot->exec= file_load_exec;
+ ot->exec= file_exec;
ot->poll= ED_operator_file_active; /* <- important, handler is on window level */
}
+
int file_parent_exec(bContext *C, wmOperator *unused)
{
SpaceFile *sfile= (SpaceFile*)CTX_wm_space_data(C);
@@ -530,11 +538,11 @@
}
-void ED_FILE_OT_parent(struct wmOperatorType *ot)
+void FILE_OT_parent(struct wmOperatorType *ot)
{
/* identifiers */
ot->name= "Parent File";
- ot->idname= "ED_FILE_OT_parent";
+ ot->idname= "FILE_OT_parent";
/* api callbacks */
ot->exec= file_parent_exec;
Modified: branches/blender2.5/blender/source/blender/editors/space_file/space_file.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_file/space_file.c 2009-02-14 13:18:18 UTC (rev 18968)
+++ branches/blender2.5/blender/source/blender/editors/space_file/space_file.c 2009-02-14 14:25:48 UTC (rev 18969)
@@ -251,31 +251,31 @@
void file_operatortypes(void)
{
- WM_operatortype_append(ED_FILE_OT_select);
- WM_operatortype_append(ED_FILE_OT_select_all);
- WM_operatortype_append(ED_FILE_OT_border_select);
- WM_operatortype_append(ED_FILE_OT_select_bookmark);
- WM_operatortype_append(ED_FILE_OT_loadimages);
- WM_operatortype_append(ED_FILE_OT_highlight);
- WM_operatortype_append(ED_FILE_OT_load);
- WM_operatortype_append(ED_FILE_OT_cancel);
- WM_operatortype_append(ED_FILE_OT_parent);
+ WM_operatortype_append(FILE_OT_select);
+ WM_operatortype_append(FILE_OT_select_all);
+ WM_operatortype_append(FILE_OT_border_select);
+ WM_operatortype_append(FILE_OT_select_bookmark);
+ WM_operatortype_append(FILE_OT_loadimages);
+ WM_operatortype_append(FILE_OT_highlight);
+ WM_operatortype_append(FILE_OT_exec);
+ WM_operatortype_append(FILE_OT_cancel);
+ WM_operatortype_append(FILE_OT_parent);
}
/* NOTE: do not add .blend file reading on this level */
void file_keymap(struct wmWindowManager *wm)
{
ListBase *keymap= WM_keymap_listbase(wm, "File", SPACE_FILE, 0);
- WM_keymap_add_item(keymap, "ED_FILE_OT_select", LEFTMOUSE, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "ED_FILE_OT_select_all", AKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "ED_FILE_OT_border_select", BKEY, KM_PRESS, 0, 0);
- WM_keymap_add_item(keymap, "ED_FILE_OT_highlight", MOUSEMOVE, KM_ANY, 0, 0);
- WM_keymap_add_item(keymap, "ED_FILE_OT_parent", PKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "FILE_OT_select", LEFTMOUSE, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "FILE_OT_select_all", AKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "FILE_OT_border_select", BKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "FILE_OT_highlight", MOUSEMOVE, KM_ANY, 0, 0);
+ WM_keymap_add_item(keymap, "FILE_OT_parent", PKEY, KM_PRESS, 0, 0);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list