feature restored: window title shows file name, 
if saved/loaded.
This commit is contained in:
Ton Roosendaal
2009-02-13 13:33:01 +00:00
parent 4d0f30f475
commit 1d5115c251
4 changed files with 25 additions and 12 deletions

View File

@@ -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);

View File

@@ -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();
}

View File

@@ -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;

View File

@@ -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);