diff options
-rw-r--r-- | source/blender/blenkernel/intern/blender.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 7 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 26 | ||||
-rw-r--r-- | source/blender/windowmanager/wm_window.h | 2 |
4 files changed, 25 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 4ad7d6da608..64acd933d46 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -318,8 +318,6 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename) /* free G.main Main database */ clear_global(); - if(mode!='u') G.save_over = 1; - G.main= bfd->main; CTX_data_main_set(C, G.main); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 484d97e7b71..d4501c88e15 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -93,6 +93,7 @@ #include "WM_api.h" #include "WM_types.h" #include "wm.h" +#include "wm_window.h" /***/ @@ -521,6 +522,7 @@ void WM_read_file(bContext *C, char *name, ReportList *reports) wm_window_match_init(C, &wmbase); retval= BKE_read_file(C, name, NULL, reports); + G.save_over = 1; /* match the read WM with current WM */ wm_window_match_do(C, &wmbase); @@ -865,10 +867,9 @@ void WM_write_file(bContext *C, char *target, ReportList *reports) G.relbase_valid = 1; strcpy(G.main->name, di); /* is guaranteed current file */ -// XXX mainwindow_set_filename_to_title(G.main->name); - G.save_over = 1; - + wm_window_titles(CTX_wm_manager(C)); + writeBlog(); } diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 67eb043b1cf..a6eba6df0e6 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -28,6 +28,7 @@ #include <stdlib.h> #include <stdio.h> +#include <string.h> #include "DNA_listBase.h" #include "DNA_screen_types.h" @@ -180,6 +181,21 @@ static void wm_window_close(bContext *C, wmWindow *win) WM_exit(C); } +void wm_window_titles(wmWindowManager *wm) +{ + if(G.save_over) { + wmWindow *win; + char *str= MEM_mallocN(strlen(G.sce) + 16, "title"); + + sprintf(str, "Blender [%s]", G.sce); + + for(win= wm->windows.first; win; win= win->next) + GHOST_SetTitle(win->ghostwin, str); + + MEM_freeN(str); + } +} + /* belongs to below */ static void wm_window_add_ghostwindow(wmWindowManager *wm, char *title, wmWindow *win) { @@ -267,15 +283,16 @@ void wm_window_add_ghostwindows(wmWindowManager *wm) if(win->eventstate==NULL) win->eventstate= MEM_callocN(sizeof(wmEvent), "window event state"); - /* add keymap handlers (1 handler for all keys in map!) */ keymap= WM_keymap_listbase(wm, "Window", 0, 0); WM_event_add_keymap_handler(&win->handlers, keymap); keymap= WM_keymap_listbase(wm, "Screen", 0, 0); WM_event_add_keymap_handler(&win->handlers, keymap); - } + + wm_window_titles(wm); + } /* new window, no screen yet, but we open ghostwindow for it */ @@ -632,11 +649,6 @@ void WM_event_remove_window_timer(wmWindow *win, wmTimer *timer) /* ************************************ */ -void wm_window_set_title(wmWindow *win, char *title) -{ - GHOST_SetTitle(win->ghostwin, title); -} - void wm_window_get_position(wmWindow *win, int *posx_r, int *posy_r) { *posx_r= win->posx; diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h index 86ceac9203e..5db86989fd9 100644 --- a/source/blender/windowmanager/wm_window.h +++ b/source/blender/windowmanager/wm_window.h @@ -36,6 +36,8 @@ 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_add_ghostwindows (wmWindowManager *wm); void wm_window_process_events (const bContext *C); |