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:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-11-08 02:12:19 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2012-11-08 02:12:19 +0400
commita8a2782d34fd09a35598c2653a8225942c4c2ca0 (patch)
tree4715ccd75214e81662e2cfa684aaad610c8d25e5 /source/blender/windowmanager
parentdd633f1affc8951a0a6ba19cdffbb58ac7f54acd (diff)
parentb51908b913f318986a91c766980ed01010c5249a (diff)
Merged changes in the trunk up to revision 51985.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/WM_api.h6
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c4
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c64
-rw-r--r--source/blender/windowmanager/intern/wm_files.c4
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c29
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c41
6 files changed, 79 insertions, 69 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index b9a4e720230..c53c4dca74c 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -106,7 +106,7 @@ int WM_homefile_read_exec(struct bContext *C, struct wmOperator *op);
int WM_homefile_read(struct bContext *C, struct ReportList *reports, short from_memory);
int WM_homefile_write_exec(struct bContext *C, struct wmOperator *op);
void WM_file_read(struct bContext *C, const char *filepath, struct ReportList *reports);
-int WM_file_write(struct bContext *C, const char *target, int fileflags, struct ReportList *reports, int copy);
+int WM_file_write(struct bContext *C, const char *target, int fileflags, struct ReportList *reports);
void WM_autosave_init(struct wmWindowManager *wm);
/* mouse cursors */
@@ -320,9 +320,9 @@ enum {
WM_JOB_SUSPEND = (1 << 3)
};
-/* identifying jobs by owner alone is unreliable, this isnt saved, order can change */
+/* identifying jobs by owner alone is unreliable, this isnt saved, order can change (keep 0 for 'any') */
enum {
- WM_JOB_TYPE_ANY = -1,
+ WM_JOB_TYPE_ANY = 0,
WM_JOB_TYPE_COMPOSITE,
WM_JOB_TYPE_RENDER,
WM_JOB_TYPE_RENDER_PREVIEW, /* UI preview */
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 66bb321e832..d7285ec4380 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -84,7 +84,7 @@ static void wm_paintcursor_draw(bContext *C, ARegion *ar)
bScreen *screen = win->screen;
wmPaintCursor *pc;
- if (screen->subwinactive == ar->swinid) {
+ if (ar->swinid && screen->subwinactive == ar->swinid) {
for (pc = wm->paintcursors.first; pc; pc = pc->next) {
if (pc->poll == NULL || pc->poll(C)) {
ARegion *ar_other = CTX_wm_region(C);
@@ -631,7 +631,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
if (paintcursor && wm->paintcursors.first) {
for (sa = screen->areabase.first; sa; sa = sa->next) {
for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->swinid == screen->subwinactive) {
+ if (ar->swinid && ar->swinid == screen->subwinactive) {
CTX_wm_area_set(C, sa);
CTX_wm_region_set(C, ar);
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index fee94b95a6a..7cfa3ce9396 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2731,47 +2731,45 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
event = *evt;
switch (type) {
- /* mouse move */
+ /* mouse move, also to inactive window (X11 does this) */
case GHOST_kEventCursorMove:
{
- if (win->active) {
- GHOST_TEventCursorData *cd = customdata;
- wmEvent *lastevent = win->queue.last;
- int cx, cy;
-
- GHOST_ScreenToClient(win->ghostwin, cd->x, cd->y, &cx, &cy);
- evt->x = cx;
- evt->y = (win->sizey - 1) - cy;
-
- event.x = evt->x;
- event.y = evt->y;
+ GHOST_TEventCursorData *cd = customdata;
+ wmEvent *lastevent = win->queue.last;
+ int cx, cy;
+
+ GHOST_ScreenToClient(win->ghostwin, cd->x, cd->y, &cx, &cy);
+ evt->x = cx;
+ evt->y = (win->sizey - 1) - cy;
+
+ event.x = evt->x;
+ event.y = evt->y;
- event.type = MOUSEMOVE;
+ event.type = MOUSEMOVE;
- /* some painting operators want accurate mouse events, they can
- * handle in between mouse move moves, others can happily ignore
- * them for better performance */
- if (lastevent && lastevent->type == MOUSEMOVE)
- lastevent->type = INBETWEEN_MOUSEMOVE;
+ /* some painting operators want accurate mouse events, they can
+ * handle in between mouse move moves, others can happily ignore
+ * them for better performance */
+ if (lastevent && lastevent->type == MOUSEMOVE)
+ lastevent->type = INBETWEEN_MOUSEMOVE;
- update_tablet_data(win, &event);
- wm_event_add(win, &event);
+ update_tablet_data(win, &event);
+ wm_event_add(win, &event);
+
+ /* also add to other window if event is there, this makes overdraws disappear nicely */
+ /* it remaps mousecoord to other window in event */
+ owin = wm_event_cursor_other_windows(wm, win, &event);
+ if (owin) {
+ wmEvent oevent = *(owin->eventstate);
- /* also add to other window if event is there, this makes overdraws disappear nicely */
- /* it remaps mousecoord to other window in event */
- owin = wm_event_cursor_other_windows(wm, win, &event);
- if (owin) {
- wmEvent oevent = *(owin->eventstate);
-
- oevent.x = owin->eventstate->x = event.x;
- oevent.y = owin->eventstate->y = event.y;
- oevent.type = MOUSEMOVE;
-
- update_tablet_data(owin, &oevent);
- wm_event_add(owin, &oevent);
- }
+ oevent.x = owin->eventstate->x = event.x;
+ oevent.y = owin->eventstate->y = event.y;
+ oevent.type = MOUSEMOVE;
+ update_tablet_data(owin, &oevent);
+ wm_event_add(owin, &oevent);
}
+
break;
}
case GHOST_kEventTrackpad:
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 780117c73aa..1c168bc5ac5 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -765,7 +765,7 @@ int write_crash_blend(void)
}
}
-int WM_file_write(bContext *C, const char *target, int fileflags, ReportList *reports, int copy)
+int WM_file_write(bContext *C, const char *target, int fileflags, ReportList *reports)
{
Library *li;
int len;
@@ -821,7 +821,7 @@ int WM_file_write(bContext *C, const char *target, int fileflags, ReportList *re
fileflags |= G_FILE_HISTORY; /* write file history */
if (BLO_write_file(CTX_data_main(C), filepath, fileflags, reports, thumb)) {
- if (!copy) {
+ if (!(fileflags & G_FILE_SAVE_COPY)) {
G.relbase_valid = 1;
BLI_strncpy(G.main->name, filepath, sizeof(G.main->name)); /* is guaranteed current file */
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index 42d721327b6..f5c83d48cb9 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -131,31 +131,34 @@ struct wmJob {
};
/* finds:
- * 1st priority: job with same owner and name
- * 2nd priority: job with same owner
+ * if type, compare for it, otherwise any matching job
*/
-static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const char *name)
+static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const int job_type)
{
- wmJob *wm_job, *found = NULL;
+ wmJob *wm_job;
for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next)
if (wm_job->owner == owner) {
- found = wm_job;
- if (name && strcmp(wm_job->name, name) == 0)
+
+ if (job_type) {
+ if ( wm_job->job_type == job_type)
+ return wm_job;
+ }
+ else
return wm_job;
}
- return found;
+ return NULL;
}
/* ******************* public API ***************** */
/* returns current or adds new job, but doesnt run it */
-/* every owner only gets a single job, adding a new one will stop running stop and
+/* every owner only gets a single job, adding a new one will stop running job and
* when stopped it starts the new one */
wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *name, int flag, int job_type)
{
- wmJob *wm_job = wm_job_find(wm, owner, name);
+ wmJob *wm_job = wm_job_find(wm, owner, job_type);
if (wm_job == NULL) {
wm_job = MEM_callocN(sizeof(wmJob), "new job");
@@ -167,7 +170,11 @@ wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *
wm_job->job_type = job_type;
BLI_strncpy(wm_job->name, name, sizeof(wm_job->name));
}
+ /* else: a running job, be careful */
+ /* prevent creating a job with an invalid type */
+ BLI_assert(wm_job->job_type != WM_JOB_TYPE_ANY);
+
return wm_job;
}
@@ -192,7 +199,7 @@ int WM_jobs_test(wmWindowManager *wm, void *owner, int job_type)
float WM_jobs_progress(wmWindowManager *wm, void *owner)
{
- wmJob *wm_job = wm_job_find(wm, owner, NULL);
+ wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY);
if (wm_job && wm_job->flag & WM_JOB_PROGRESS)
return wm_job->progress;
@@ -202,7 +209,7 @@ float WM_jobs_progress(wmWindowManager *wm, void *owner)
char *WM_jobs_name(wmWindowManager *wm, void *owner)
{
- wmJob *wm_job = wm_job_find(wm, owner, NULL);
+ wmJob *wm_job = wm_job_find(wm, owner, WM_JOB_TYPE_ANY);
if (wm_job)
return wm_job->name;
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 2ef33aa5964..054e48f0bfb 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -72,6 +72,7 @@
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_screen.h" /* BKE_ST_MAXNAME */
+#include "BKE_utildefines.h"
#include "BKE_idcode.h"
@@ -903,6 +904,8 @@ void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type,
prop = RNA_def_boolean(ot->srna, "filter_blender", (filter & BLENDERFILE), "Filter .blend files", "");
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+ prop = RNA_def_boolean(ot->srna, "filter_backup", (filter & BLENDERFILE_BACKUP), "Filter .blend files", "");
+ RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
prop = RNA_def_boolean(ot->srna, "filter_image", (filter & IMAGEFILE), "Filter image files", "");
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
prop = RNA_def_boolean(ot->srna, "filter_movie", (filter & MOVIEFILE), "Filter movie files", "");
@@ -1332,6 +1335,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
int i;
MenuType *mt = WM_menutype_find("USERPREF_MT_splash", TRUE);
char url[96];
+ char file [FILE_MAX];
#ifndef WITH_HEADLESS
extern char datatoc_splash_png[];
@@ -1419,7 +1423,11 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
uiItemL(col, IFACE_("Recent"), ICON_NONE);
for (recent = G.recent_files.first, i = 0; (i < 5) && (recent); recent = recent->next, i++) {
- uiItemStringO(col, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath);
+ BLI_split_file_part(recent->filepath, file, sizeof(file));
+ if (BLO_has_bfile_extension(file))
+ uiItemStringO(col, BLI_path_basename(recent->filepath), ICON_FILE_BLEND, "WM_OT_open_mainfile", "filepath", recent->filepath);
+ else
+ uiItemStringO(col, BLI_path_basename(recent->filepath), ICON_FILE_BACKUP, "WM_OT_open_mainfile", "filepath", recent->filepath);
}
uiItemS(col);
@@ -2070,7 +2078,6 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
{
char path[FILE_MAX];
int fileflags;
- int copy = 0;
save_set_compress(op);
@@ -2080,29 +2087,27 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
BLI_strncpy(path, G.main->name, FILE_MAX);
untitled(path);
}
-
- if (RNA_struct_property_is_set(op->ptr, "copy"))
- copy = RNA_boolean_get(op->ptr, "copy");
fileflags = G.fileflags;
/* set compression flag */
- if (RNA_boolean_get(op->ptr, "compress")) fileflags |= G_FILE_COMPRESS;
- else fileflags &= ~G_FILE_COMPRESS;
- if (RNA_boolean_get(op->ptr, "relative_remap")) fileflags |= G_FILE_RELATIVE_REMAP;
- else fileflags &= ~G_FILE_RELATIVE_REMAP;
+ BKE_BIT_TEST_SET(fileflags, RNA_boolean_get(op->ptr, "compress"),
+ G_FILE_COMPRESS);
+ BKE_BIT_TEST_SET(fileflags, RNA_boolean_get(op->ptr, "relative_remap"),
+ G_FILE_RELATIVE_REMAP);
+ BKE_BIT_TEST_SET(fileflags,
+ (RNA_struct_property_is_set(op->ptr, "copy") &&
+ RNA_boolean_get(op->ptr, "copy")),
+ G_FILE_SAVE_COPY);
+
#ifdef USE_BMESH_SAVE_AS_COMPAT
- /* property only exists for 'Save As' */
- if (RNA_struct_find_property(op->ptr, "use_mesh_compat")) {
- if (RNA_boolean_get(op->ptr, "use_mesh_compat")) fileflags |= G_FILE_MESH_COMPAT;
- else fileflags &= ~G_FILE_MESH_COMPAT;
- }
- else {
- fileflags &= ~G_FILE_MESH_COMPAT;
- }
+ BKE_BIT_TEST_SET(fileflags,
+ (RNA_struct_find_property(op->ptr, "use_mesh_compat") &&
+ RNA_boolean_get(op->ptr, "use_mesh_compat")),
+ G_FILE_MESH_COMPAT);
#endif
- if (WM_file_write(C, path, fileflags, op->reports, copy) != 0)
+ if (WM_file_write(C, path, fileflags, op->reports) != 0)
return OPERATOR_CANCELLED;
WM_event_add_notifier(C, NC_WM | ND_FILESAVE, NULL);