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:
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r--source/blender/windowmanager/intern/wm.c2
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c2
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c35
-rw-r--r--source/blender/windowmanager/intern/wm_files.c20
-rw-r--r--source/blender/windowmanager/intern/wm_jobs.c12
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c59
6 files changed, 96 insertions, 34 deletions
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index cfeccfd7f62..39c5e69d982 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -124,6 +124,7 @@ void wm_operator_register(bContext *C, wmOperator *op)
/* so the console is redrawn */
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_CONSOLE_REPORT, NULL);
+ WM_event_add_notifier(C, NC_WM|ND_HISTORY, NULL);
}
@@ -137,6 +138,7 @@ void WM_operator_stack_clear(bContext *C)
WM_operator_free(op);
}
+ WM_event_add_notifier(C, NC_WM|ND_HISTORY, NULL);
}
/* ****************************************** */
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index fec46d32a08..008abceba4c 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -674,6 +674,8 @@ static int wm_automatic_draw_method(wmWindow *win)
/* Windows software driver darkens color on each redraw */
else if(GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_WIN, GPU_DRIVER_SOFTWARE))
return USER_DRAW_OVERLAP_FLIP;
+ else if(!GPU_24bit_color_support())
+ return USER_DRAW_OVERLAP;
else
return USER_DRAW_TRIPLE;
}
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 19a7ae38b7f..72e34eea2ba 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1240,6 +1240,10 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
handler->op->reports->printlevel = RPT_WARNING;
uiPupMenuReports(C, handler->op->reports);
+ /* XXX - copied from 'wm_operator_finished()' */
+ /* add reports to the global list, otherwise they are not seen */
+ addlisttolist(&CTX_wm_reports(C)->list, &handler->op->reports->list);
+
CTX_wm_window_set(C, win_prev);
}
@@ -1544,31 +1548,30 @@ void wm_event_do_handlers(bContext *C)
if( win->screen==NULL )
wm_event_free_all(win);
- else
- {
+ else {
Scene* scene = win->screen->scene;
- if(scene)
- {
+
+ if(scene) {
int playing = sound_scene_playing(win->screen->scene);
- if(playing != -1)
- {
+
+ if(playing != -1) {
CTX_wm_window_set(C, win);
CTX_wm_screen_set(C, win->screen);
CTX_data_scene_set(C, scene);
- if(((playing == 1) && (!win->screen->animtimer)) || ((playing == 0) && (win->screen->animtimer)))
- {
+
+ if(((playing == 1) && (!win->screen->animtimer)) || ((playing == 0) && (win->screen->animtimer))){
ED_screen_animation_play(C, -1, 1);
}
- if(playing == 0)
- {
+
+ if(playing == 0) {
int ncfra = floor(sound_sync_scene(scene) * FPS);
- if(ncfra != scene->r.cfra)
- {
+ if(ncfra != scene->r.cfra) {
scene->r.cfra = ncfra;
ED_update_for_newframe(C, 1);
WM_event_add_notifier(C, NC_WINDOW, NULL);
}
}
+
CTX_data_scene_set(C, NULL);
CTX_wm_screen_set(C, NULL);
CTX_wm_window_set(C, NULL);
@@ -1579,6 +1582,9 @@ void wm_event_do_handlers(bContext *C)
while( (event= win->queue.first) ) {
int action = WM_HANDLER_CONTINUE;
+ if((G.f & G_DEBUG) && event && event->type!=MOUSEMOVE)
+ printf("pass on evt %d val %d\n", event->type, event->val);
+
wm_eventemulation(event);
CTX_wm_window_set(C, win);
@@ -2127,11 +2133,10 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int t
if(owin) {
wmEvent oevent= *(owin->eventstate);
- oevent.x= event.x;
- oevent.y= event.y;
+ oevent.x=owin->eventstate->x= event.x;
+ oevent.y=owin->eventstate->y= event.y;
oevent.type= MOUSEMOVE;
- *(owin->eventstate)= oevent;
update_tablet_data(owin, &oevent);
wm_event_add(owin, &oevent);
}
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index f79b083857e..b6126da33a2 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -296,11 +296,14 @@ void WM_read_file(bContext *C, char *name, ReportList *reports)
WM_event_add_notifier(C, NC_WM|ND_FILEREAD, NULL);
// refresh_interface_font();
- CTX_wm_window_set(C, NULL); /* exits queues */
+ CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first);
+ ED_editors_init(C);
+
#ifndef DISABLE_PYTHON
/* run any texts that were loaded in and flagged as modules */
BPY_load_user_modules(C);
#endif
+ CTX_wm_window_set(C, NULL); /* exits queues */
}
else if(retval==1)
BKE_write_undo(C, "Import file");
@@ -480,7 +483,7 @@ static void do_history(char *name, ReportList *reports)
BKE_report(reports, RPT_ERROR, "Unable to make version backup");
}
-void WM_write_file(bContext *C, char *target, int fileflags, ReportList *reports)
+int WM_write_file(bContext *C, char *target, int fileflags, ReportList *reports)
{
Library *li;
int len;
@@ -488,17 +491,21 @@ void WM_write_file(bContext *C, char *target, int fileflags, ReportList *reports
len = strlen(target);
- if (len == 0) return;
+ if (len == 0) {
+ BKE_report(reports, RPT_ERROR, "Path is empty, cannot save");
+ return -1;
+ }
+
if (len >= FILE_MAX) {
BKE_report(reports, RPT_ERROR, "Path too long, cannot save");
- return;
+ return -1;
}
/* send the OnSave event */
for (li= G.main->library.first; li; li= li->id.next) {
if (BLI_streq(li->name, target)) {
BKE_report(reports, RPT_ERROR, "Cannot overwrite used library");
- return;
+ return -1;
}
}
@@ -536,9 +543,12 @@ void WM_write_file(bContext *C, char *target, int fileflags, ReportList *reports
else G.fileflags &= ~G_FILE_AUTOPLAY;
writeBlog();
+ } else {
+ return -1;
}
// XXX waitcursor(0);
+ return 0;
}
/* operator entry */
diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c
index 343b1f68c7f..30c0c9a7aec 100644
--- a/source/blender/windowmanager/intern/wm_jobs.c
+++ b/source/blender/windowmanager/intern/wm_jobs.c
@@ -95,6 +95,8 @@ struct wmJob {
void (*update)(void *);
/* free entire customdata, doesn't run in thread */
void (*free)(void *);
+ /* gets called when job is stopped, not in thread */
+ void (*endjob)(void *);
/* running jobs each have own timer */
double timestep;
@@ -179,11 +181,13 @@ void WM_jobs_timer(wmJob *steve, double timestep, unsigned int note, unsigned in
void WM_jobs_callbacks(wmJob *steve,
void (*startjob)(void *, short *, short *),
void (*initjob)(void *),
- void (*update)(void *))
+ void (*update)(void *),
+ void (*endjob)(void *))
{
steve->startjob= startjob;
steve->initjob= initjob;
steve->update= update;
+ steve->endjob= endjob;
}
static void *do_job_thread(void *job_v)
@@ -266,6 +270,9 @@ static void wm_jobs_kill_job(wmWindowManager *wm, wmJob *steve)
/* signal job to end */
steve->stop= 1;
BLI_end_threads(&steve->threads);
+
+ if(steve->endjob)
+ steve->endjob(steve->run_customdata);
}
if(steve->wt)
@@ -351,6 +358,9 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
}
if(steve->ready) {
+ if(steve->endjob)
+ steve->endjob(steve->run_customdata);
+
/* free own data */
steve->run_free(steve->run_customdata);
steve->run_customdata= NULL;
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index e9a57a431dc..bd2263865c8 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1127,6 +1127,19 @@ static void wm_block_splash_close(bContext *C, void *arg_block, void *arg_unused
uiPupBlockClose(C, arg_block);
}
+static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unused);
+
+/* XXX: hack to refresh splash screen with updated prest menu name,
+ * since popup blocks don't get regenerated like panels do */
+void wm_block_splash_refreshmenu (bContext *C, void *arg_block, void *unused)
+{
+ /* ugh, causes crashes in other buttons, disabling for now until
+ * a better fix
+ uiPupBlockClose(C, arg_block);
+ uiPupBlock(C, wm_block_create_splash, NULL);
+ */
+}
+
static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unused)
{
uiBlock *block;
@@ -1135,7 +1148,9 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse
uiStyle *style= U.uistyles.first;
struct RecentFile *recent;
int i;
-
+ Menu menu= {0};
+ MenuType *mt= WM_menutype_find("USERPREF_MT_splash", TRUE);
+
#ifdef NAN_BUILDINFO
int ver_width, rev_width;
char *version_str = NULL;
@@ -1156,21 +1171,28 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse
#endif //NAN_BUILDINFO
block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
- uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN|UI_BLOCK_RET_1);
+ uiBlockSetFlag(block, UI_BLOCK_KEEP_OPEN);
but= uiDefBut(block, BUT_IMAGE, 0, "", 0, 10, 501, 282, NULL, 0.0, 0.0, 0, 0, "");
uiButSetFunc(but, wm_block_splash_close, block, NULL);
+ uiBlockSetFunc(block, wm_block_splash_refreshmenu, block, NULL);
#ifdef NAN_BUILDINFO
- uiDefBut(block, LABEL, 0, version_str, 500-ver_width, 282-24, ver_width, 20, NULL, 0, 0, 0, 0, NULL);
- uiDefBut(block, LABEL, 0, revision_str, 500-rev_width, 282-36, rev_width, 20, NULL, 0, 0, 0, 0, NULL);
+ uiDefBut(block, LABEL, 0, version_str, 494-ver_width, 282-24, ver_width, 20, NULL, 0, 0, 0, 0, NULL);
+ uiDefBut(block, LABEL, 0, revision_str, 494-rev_width, 282-36, rev_width, 20, NULL, 0, 0, 0, 0, NULL);
#endif //NAN_BUILDINFO
+ layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 10, 2, 480, 110, style);
- uiBlockSetEmboss(block, UI_EMBOSSP);
+ uiBlockSetEmboss(block, UI_EMBOSS);
+ /* show the splash menu (containing interaction presets), using python */
+ if (mt) {
+ menu.layout= layout;
+ menu.type= mt;
+ mt->draw(C, &menu);
+ }
- layout= uiBlockLayout(block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 10, 10, 480, 110, style);
-
+ uiBlockSetEmboss(block, UI_EMBOSSP);
uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN);
split = uiLayoutSplit(layout, 0, 0);
@@ -1185,7 +1207,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse
col = uiLayoutColumn(split, 0);
uiItemL(col, "Recent", 0);
- for(recent = G.recent_files.first, i=0; (i<6) && (recent); recent = recent->next, i++) {
+ for(recent = G.recent_files.first, i=0; (i<5) && (recent); recent = recent->next, i++) {
char *display_name= BLI_last_slash(recent->filename);
if(display_name) display_name++; /* skip the slash */
else display_name= recent->filename;
@@ -1194,7 +1216,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse
uiItemS(col);
uiItemO(col, NULL, ICON_HELP, "WM_OT_recover_last_session");
uiItemL(col, "", 0);
-
+
uiCenteredBoundsBlock(block, 0.0f);
uiEndBlock(C, block);
@@ -1482,6 +1504,7 @@ static short wm_link_append_flag(wmOperator *op)
if(RNA_boolean_get(op->ptr, "relative_path")) flag |= FILE_RELPATH;
if(RNA_boolean_get(op->ptr, "link")) flag |= FILE_LINK;
if(RNA_boolean_get(op->ptr, "instance_groups")) flag |= FILE_GROUP_INSTANCE;
+
return flag;
}
@@ -1554,6 +1577,14 @@ static int wm_link_append_exec(bContext *C, wmOperator *op)
flag = wm_link_append_flag(op);
+ /* sanity checks for flag */
+ if(scene->id.lib && (flag & FILE_GROUP_INSTANCE)) {
+ /* TODO, user never gets this message */
+ BKE_reportf(op->reports, RPT_WARNING, "Scene '%s' is linked, group instance disabled", scene->id.name+2);
+ flag &= ~FILE_GROUP_INSTANCE;
+ }
+
+
/* tag everything, all untagged data can be made local
* its also generally useful to know what is new
*
@@ -1761,11 +1792,12 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
if(RNA_boolean_get(op->ptr, "relative_remap")) fileflags |= G_FILE_RELATIVE_REMAP;
else fileflags &= ~G_FILE_RELATIVE_REMAP;
- WM_write_file(C, path, fileflags, op->reports);
-
+ if ( WM_write_file(C, path, fileflags, op->reports) != 0)
+ return OPERATOR_CANCELLED;
+
WM_event_add_notifier(C, NC_WM|ND_FILESAVE, NULL);
- return 0;
+ return OPERATOR_FINISHED;
}
static void WM_OT_save_as_mainfile(wmOperatorType *ot)
@@ -3065,7 +3097,7 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf)
WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_ANY, KM_ANY, 0, GESTURE_MODAL_CANCEL);
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_BEGIN);
- WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, 0, 0, GESTURE_MODAL_SELECT);
+ WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_ANY, 0, GESTURE_MODAL_SELECT);
#if 0 // Durian guys like this
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_SHIFT, 0, GESTURE_MODAL_BEGIN);
@@ -3151,6 +3183,7 @@ void wm_window_keymap(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "WM_OT_link_append", OKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
kmi= WM_keymap_add_item(keymap, "WM_OT_link_append", F1KEY, KM_PRESS, KM_SHIFT, 0);
RNA_boolean_set(kmi->ptr, "link", FALSE);
+ RNA_boolean_set(kmi->ptr, "instance_groups", FALSE);
WM_keymap_add_item(keymap, "WM_OT_save_mainfile", SKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "WM_OT_save_mainfile", WKEY, KM_PRESS, KM_CTRL, 0);