Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2009-02-14 17:25:48 +0300
committerTon Roosendaal <ton@blender.org>2009-02-14 17:25:48 +0300
commit05cdff9bf1687a6998e8bd13b21003e97e98c81d (patch)
treeee64b1bb5bd24119bd405def6a3e114c73db2aea /source/blender/editors/space_file/file_ops.c
parent3f425dfc715d846fe9127eaed1a398c747b41f01 (diff)
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.
Diffstat (limited to 'source/blender/editors/space_file/file_ops.c')
-rw-r--r--source/blender/editors/space_file/file_ops.c56
1 files changed, 32 insertions, 24 deletions
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index b584524e396..1d1f31c4221 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -220,11 +220,11 @@ static int file_border_select_exec(bContext *C, wmOperator *op)
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 @@ static int file_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
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 @@ static int file_select_all_invoke(bContext *C, wmOperator *op, wmEvent *event)
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 @@ static int bookmark_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
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 @@ static int loadimages_invoke(bContext *C, wmOperator *op, wmEvent *event)
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 @@ static int file_highlight_invoke(bContext *C, wmOperator *op, wmEvent *event)
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 @@ int file_cancel_exec(bContext *C, wmOperator *unused)
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 @@ void ED_FILE_OT_cancel(struct wmOperatorType *ot)
}
-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 @@ int file_load_exec(bContext *C, wmOperator *unused)
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 @@ int file_parent_exec(bContext *C, wmOperator *unused)
}
-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;