diff options
author | Ton Roosendaal <ton@blender.org> | 2009-02-18 16:29:54 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2009-02-18 16:29:54 +0300 |
commit | 1090b0c598712a8375e6189447b461ddd3d781b6 (patch) | |
tree | cde5a33c17d262cdf5dd7b7a88c6f3021197686f /source/blender/windowmanager | |
parent | 915e989f9d60d4523563f14b71df8c7f6d5e812e (diff) |
2.5
Several things in one commit; could not split this up easily,
one job invoked another, and so on. :)
- Added pulldowns for save/load .blend file in top bar.
- To enable "Save" without further popups (save over)
I've added a signaling function in window header to
indicate a succesful save.
- On any undo push it now signals 'file changed'. This
goes by notifiers nicely, but now registers only the
undopushes, which is quite unreliable. "Changed" state
shows in header as "Blender*" and for OSX with the
standard close button black dot.
- Made screencast show a button in top bar indicating such,
and allowing quit. No hotkey for quit yet... but ESC will
keep casting now.
- Fixed new BLF_init(), which should be in WM_init() and not
on any .B.blend read.
- Fixed CTRL+F3 "Save Screenshot", which was still using old
fileselect code.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/WM_types.h | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm.c | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 11 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 11 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_init_exit.c | 3 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_jobs.c | 11 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 9 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 31 | ||||
-rw-r--r-- | source/blender/windowmanager/wm_window.h | 2 |
10 files changed, 64 insertions, 20 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 45dd2f3aee2..2dd1aa871c2 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -203,6 +203,7 @@ void WM_jobs_callbacks(struct wmJob *, void (*update)(void *)); void WM_jobs_start(struct wmJob *); +void WM_jobs_stop(struct wmWindowManager *wm, void *owner); void WM_jobs_stop_all(struct wmWindowManager *wm); #endif /* WM_API_H */ diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 2e7b31b0700..d67a31f9e42 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -160,9 +160,13 @@ typedef struct wmNotifier { /* NC_WM windowmanager */ #define ND_FILEREAD (1<<16) +#define ND_FILESAVE (2<<16) +#define ND_DATACHANGED (3<<16) /* NC_SCREEN screen */ #define ND_SCREENBROWSE (1<<16) +#define ND_SCREENCAST (2<<16) + /* NC_SCENE Scene */ #define ND_SCENEBROWSE (1<<16) diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 56d8788fdcb..e209a9e658f 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -135,6 +135,7 @@ void wm_add_default(bContext *C) BLI_strncpy(win->screenname, screen->id.name+2, 21); wm->winactive= win; + wm->file_saved= 1; wm_window_make_drawable(C, win); } diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 804c8e6b828..9fe97f307c5 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -141,6 +141,14 @@ void wm_event_do_notifiers(bContext *C) CTX_wm_window_set(C, win); for(note= wm->queue.first; note; note= note->next) { + if(note->category==NC_WM) { + if( ELEM(note->data, ND_FILEREAD, ND_FILESAVE)) { + wm->file_saved= 1; + wm_window_title(wm, win); + } + else if(note->data==ND_DATACHANGED) + wm_window_title(wm, win); + } if(note->window==win) { if(note->category==NC_SCREEN) { if(note->data==ND_SCREENBROWSE) @@ -177,7 +185,7 @@ void wm_event_do_notifiers(bContext *C) /* XXX context in notifiers? */ CTX_wm_window_set(C, win); - /* printf("notifier win %d screen %s\n", win->winid, win->screen->id.name+2); */ + /* printf("notifier win %d screen %s cat %x\n", win->winid, win->screen->id.name+2, note->category); */ ED_screen_do_listen(win, note); for(ar=win->screen->regionbase.first; ar; ar= ar->next) { @@ -776,6 +784,7 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa wm_handler_op_context(C, handler); /* a bit weak, might become arg for WM_event_fileselect? */ + /* XXX also extension code in image-save doesnt work for this yet */ if(strncmp(handler->op->type->name, "Save", 4)==0) { /* this gives ownership to pupmenu */ uiPupMenuSaveOver(C, handler->op, path); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index cf93b4f0df3..7fc0efc4370 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -84,7 +84,6 @@ #include "GHOST_C-api.h" #include "UI_interface.h" -#include "BLF_api.h" #include "GPU_draw.h" @@ -588,10 +587,7 @@ int WM_read_homefile(bContext *C, wmOperator *op) wm_check(C); /* opens window(s), checks keymaps */ strcpy(G.sce, scestr); /* restore */ - - BLF_lang_init(); - BLF_init(); - + init_userdef_themes(); /* When loading factory settings, the reset solid OpenGL lights need to be applied. */ @@ -868,8 +864,7 @@ void WM_write_file(bContext *C, char *target, ReportList *reports) G.relbase_valid = 1; strcpy(G.main->name, di); /* is guaranteed current file */ - G.save_over = 1; - wm_window_titles(CTX_wm_manager(C)); + G.save_over = 1; /* disable untitled.blend convention */ writeBlog(); } @@ -890,6 +885,8 @@ int WM_write_homefile(bContext *C, wmOperator *op) BLO_write_file(CTX_data_main(C), tstr, write_flags, op->reports); + G.save_over= 0; + return OPERATOR_FINISHED; } diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index df3ad0d6d5c..9c13a321cf1 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -121,6 +121,9 @@ void WM_init(bContext *C) ED_file_init(); /* for fsmenu */ ED_init_node_butfuncs(); + BLF_init(); + BLF_lang_init(); + /* get the default database, plus a wm */ WM_read_homefile(C, NULL); diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c index 40a72034d26..31c3a803246 100644 --- a/source/blender/windowmanager/intern/wm_jobs.c +++ b/source/blender/windowmanager/intern/wm_jobs.c @@ -249,6 +249,17 @@ void WM_jobs_stop_all(wmWindowManager *wm) BLI_freelistN(&wm->jobs); } +/* stops job(s) from this owner */ +void WM_jobs_stop(wmWindowManager *wm, void *owner) +{ + wmJob *steve; + + for(steve= wm->jobs.first; steve; steve= steve->next) + if(steve->owner==owner) + if(steve->running) + steve->stop= 1; +} + /* hardcoded to event TIMERJOBS */ static int wm_jobs_timer(bContext *C, wmOperator *op, wmEvent *evt) { diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 9626fda6ffe..3729365694f 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -412,11 +412,16 @@ static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *even static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op) { char filename[FILE_MAX]; - RNA_string_get(op->ptr, "filename", filename); + if(RNA_property_is_set(op->ptr, "filename")) + RNA_string_get(op->ptr, "filename", filename); + else { + BLI_strncpy(filename, G.sce, FILE_MAX); + untitled(filename); + } WM_write_file(C, filename, op->reports); - WM_event_add_notifier(C, NC_WINDOW, NULL); + WM_event_add_notifier(C, NC_WM|ND_FILESAVE, NULL); return 0; } diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 30c5d7e3a10..43871ba5a7f 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -181,19 +181,31 @@ static void wm_window_close(bContext *C, wmWindow *win) WM_exit(C); } -void wm_window_titles(wmWindowManager *wm) +void wm_window_title(wmWindowManager *wm, wmWindow *win) { + /* this is set to 1 if you don't have .B.blend open */ if(G.save_over) { - wmWindow *win; char *str= MEM_mallocN(strlen(G.sce) + 16, "title"); - sprintf(str, "Blender [%s]", G.sce); + if(wm->file_saved) + sprintf(str, "Blender [%s]", G.sce); + else + sprintf(str, "Blender* [%s]", G.sce); + + GHOST_SetTitle(win->ghostwin, str); - for(win= wm->windows.first; win; win= win->next) - GHOST_SetTitle(win->ghostwin, str); - MEM_freeN(str); } + else + GHOST_SetTitle(win->ghostwin, "Blender"); + +#ifdef __APPLE__ + if(wm->file_saved) + GHOST_SetWindowState(win->ghostwin, GHOST_kWindowStateUnModified); + else + GHOST_SetWindowState(win->ghostwin, GHOST_kWindowStateModified); +#endif + } /* belongs to below */ @@ -236,6 +248,8 @@ static void wm_window_add_ghostwindow(wmWindowManager *wm, char *title, wmWindow glClear(GL_COLOR_BUFFER_BIT); wm_window_swap_buffers(win); + //GHOST_SetWindowState(ghostwin, GHOST_kWindowStateModified); + /* standard state vars for window */ glEnable(GL_SCISSOR_TEST); @@ -289,10 +303,9 @@ void wm_window_add_ghostwindows(wmWindowManager *wm) keymap= WM_keymap_listbase(wm, "Screen", 0, 0); WM_event_add_keymap_handler(&win->handlers, keymap); + + wm_window_title(wm, win); } - - wm_window_titles(wm); - } /* new window, no screen yet, but we open ghostwindow for it */ diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h index 5db86989fd9..f386510a2eb 100644 --- a/source/blender/windowmanager/wm_window.h +++ b/source/blender/windowmanager/wm_window.h @@ -37,7 +37,7 @@ void wm_ghost_init (bContext *C); wmWindow *wm_window_new (bContext *C); void wm_window_free (bContext *C, wmWindow *win); -void wm_window_titles (wmWindowManager *wm); +void wm_window_title (wmWindowManager *wm, wmWindow *win); void wm_window_add_ghostwindows (wmWindowManager *wm); void wm_window_process_events (const bContext *C); |