- Added back CTRL+X "reload start-up file".
  (Original name 'erase all' is a bit misleading, but we can
  go over all naming conventions later :)
- Added memfree for triple buffer data.
This commit is contained in:
Ton Roosendaal
2009-02-07 10:00:46 +00:00
parent 86f200a510
commit 19896992ff
8 changed files with 40 additions and 12 deletions

View File

@@ -109,6 +109,10 @@ void ED_region_do_listen(ARegion *ar, wmNotifier *note)
{
/* generic notes first */
switch(note->category) {
case NC_WM:
if(note->data==ND_FILEREAD)
ED_region_tag_redraw(ar);
break;
case NC_WINDOW:
ED_region_tag_redraw(ar);
break;

View File

@@ -934,6 +934,10 @@ void ED_screen_do_listen(wmWindow *win, wmNotifier *note)
/* generic notes */
switch(note->category) {
case NC_WM:
if(note->data==ND_FILEREAD)
win->screen->do_draw= 1;
break;
case NC_WINDOW:
win->screen->do_draw= 1;
break;

View File

@@ -53,7 +53,7 @@ void WM_main (struct bContext *C);
struct wmWindow *WM_window_open (struct bContext *C, struct rcti *rect);
/* files */
int WM_read_homefile (struct bContext *C, int from_memory);
int WM_read_homefile (struct bContext *C, struct wmOperator *op);
int WM_write_homefile (struct bContext *C, struct wmOperator *op);
void WM_read_file (struct bContext *C, char *name, struct ReportList *reports);
void WM_write_file (struct bContext *C, char *target, struct ReportList *reports);

View File

@@ -118,8 +118,6 @@ void wm_check(bContext *C)
ED_screens_initialize(wm);
wm->initialized= 1;
WM_event_add_notifier(C, NC_WINDOW, NULL);
}
}

View File

@@ -74,6 +74,9 @@
#include "BLO_readfile.h"
#include "BLO_writefile.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "ED_datafiles.h"
#include "ED_screen.h"
#include "ED_util.h"
@@ -518,12 +521,9 @@ void WM_read_file(bContext *C, char *name, ReportList *reports)
wm_check(C); /* opens window(s), checks keymaps */
// XXX mainwindow_set_filename_to_title(G.main->name);
// countall(); <-- will be listener
// XXX sound_initialize_sounds();
// winqueue_break= 1; /* leave queues everywhere */
// XXX if(retval==2) init_userdef_themes(); // in case a userdef is read from regular .blend
if(retval==2) init_userdef_themes(); // in case a userdef is read from regular .blend
if (retval!=0) G.relbase_valid = 1;
@@ -536,8 +536,8 @@ void WM_read_file(bContext *C, char *name, ReportList *reports)
CTX_wm_window_set(C, NULL); /* exits queues */
}
// else if(retval==1)
// XXX BIF_undo_push("Import file");
else if(retval==1)
BKE_write_undo(C, "Import file");
else if(retval == -1) {
if(reports && reports->list.first == NULL)
BKE_report(reports, RPT_ERROR, "Cannot read file.");
@@ -547,13 +547,14 @@ void WM_read_file(bContext *C, char *name, ReportList *reports)
/* called on startup, (context entirely filled with NULLs) */
/* or called for 'Erase All' */
int WM_read_homefile(bContext *C, int from_memory)
int WM_read_homefile(bContext *C, wmOperator *op)
{
ListBase wmbase;
char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR];
char *home= BLI_gethome();
int from_memory= op?RNA_boolean_get(op->ptr, "factory"):0;
int success;
BLI_clean(home);
free_ttfont(); /* still weird... what does it here? */
@@ -601,6 +602,9 @@ int WM_read_homefile(bContext *C, int from_memory)
BKE_reset_undo();
BKE_write_undo(C, "original"); /* save current state */
WM_event_add_notifier(C, NC_WM|ND_FILEREAD, NULL);
CTX_wm_window_set(C, NULL); /* exits queues */
return success;
}

View File

@@ -122,7 +122,7 @@ void WM_init(bContext *C)
ED_init_node_butfuncs();
/* get the default database, plus a wm */
WM_read_homefile(C, 0);
WM_read_homefile(C, NULL);
UI_init();

View File

@@ -279,6 +279,19 @@ static void WM_OT_save_homefile(wmOperatorType *ot)
ot->poll= WM_operator_winactive;
}
static void WM_OT_read_homefile(wmOperatorType *ot)
{
ot->name= "Reload Start-Up File";
ot->idname= "WM_OT_read_homefile";
ot->invoke= WM_operator_confirm;
ot->exec= WM_read_homefile;
ot->poll= WM_operator_winactive;
RNA_def_boolean(ot->srna, "factory", 0, "Factory Settings", "");
}
/* ********* recent file *********** */
static int recentfile_exec(bContext *C, wmOperator *op)
@@ -1145,6 +1158,7 @@ void wm_operatortype_free(void)
void wm_operatortype_init(void)
{
WM_operatortype_append(WM_OT_window_duplicate);
WM_operatortype_append(WM_OT_read_homefile);
WM_operatortype_append(WM_OT_save_homefile);
WM_operatortype_append(WM_OT_window_fullscreen_toggle);
WM_operatortype_append(WM_OT_exit_blender);
@@ -1164,6 +1178,7 @@ void wm_window_keymap(wmWindowManager *wm)
/* note, this doesn't replace existing keymap items */
WM_keymap_verify_item(keymap, "WM_OT_window_duplicate", WKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
WM_keymap_verify_item(keymap, "WM_OT_read_homefile", XKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_verify_item(keymap, "WM_OT_save_homefile", UKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_verify_item(keymap, "WM_OT_open_recentfile", OKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_verify_item(keymap, "WM_OT_open_mainfile", F1KEY, KM_PRESS, 0, 0);

View File

@@ -112,6 +112,9 @@ void wm_window_free(bContext *C, wmWindow *win)
wm_event_free_all(win);
wm_subwindows_free(win);
if(win->drawdata)
MEM_freeN(win->drawdata);
wm_ghostwindow_destroy(win);
MEM_freeN(win);