From c567cf3fab5b962a4166ef44f45c80941021b60d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 11 Aug 2012 21:35:24 +0000 Subject: code cleanup: WM naming conventions --- source/blender/windowmanager/WM_api.h | 39 +++++++++++----------- source/blender/windowmanager/WM_types.h | 6 ++-- source/blender/windowmanager/intern/wm_apple.c | 4 +-- source/blender/windowmanager/intern/wm_cursors.c | 6 ++-- .../blender/windowmanager/intern/wm_event_system.c | 6 ++-- source/blender/windowmanager/intern/wm_files.c | 14 ++++---- source/blender/windowmanager/intern/wm_init_exit.c | 4 +-- source/blender/windowmanager/intern/wm_jobs.c | 4 +-- source/blender/windowmanager/intern/wm_operators.c | 22 ++++++------ source/blender/windowmanager/intern/wm_subwindow.c | 2 +- source/blender/windowmanager/intern/wm_window.c | 6 ++-- 11 files changed, 57 insertions(+), 56 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index ee7b44fb1e9..7a6c53a7d01 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -37,6 +37,7 @@ * \todo document */ + /* dna-savable wmStructs here */ #include "DNA_windowmanager_types.h" #include "WM_keymap.h" @@ -66,8 +67,8 @@ typedef struct wmJob wmJob; /* general API */ void WM_setprefsize (int stax, int stay, int sizx, int sizy); -void WM_setinitialstate_fullscreen(void); -void WM_setinitialstate_normal(void); +void WM_init_state_fullscreen_set(void); +void WM_init_state_normal_set(void); void WM_init (struct bContext *C, int argc, const char **argv); void WM_exit_ext (struct bContext *C, const short do_python); @@ -92,21 +93,21 @@ void WM_window_open_temp (struct bContext *C, struct rcti *position, int type); /* files */ -int WM_read_homefile_exec(struct bContext *C, struct wmOperator *op); -int WM_read_homefile (struct bContext *C, struct ReportList *reports, short from_memory); -int WM_write_homefile (struct bContext *C, struct wmOperator *op); -void WM_read_file (struct bContext *C, const char *filepath, struct ReportList *reports); -int WM_write_file (struct bContext *C, const char *target, int fileflags, struct ReportList *reports, int copy); -void WM_autosave_init (struct wmWindowManager *wm); +int WM_homefile_read_exec(struct bContext *C, struct wmOperator *op); +int WM_homefile_read(struct bContext *C, struct ReportList *reports, short from_memory); +int WM_homefile_write_exec(struct bContext *C, struct wmOperator *op); +void WM_file_read(struct bContext *C, const char *filepath, struct ReportList *reports); +int WM_file_write(struct bContext *C, const char *target, int fileflags, struct ReportList *reports, int copy); +void WM_autosave_init(struct wmWindowManager *wm); /* mouse cursors */ void WM_cursor_set (struct wmWindow *win, int curs); void WM_cursor_modal (struct wmWindow *win, int curs); void WM_cursor_restore (struct wmWindow *win); void WM_cursor_wait (int val); -void WM_cursor_grab(struct wmWindow *win, int wrap, int hide, int *bounds); -void WM_cursor_ungrab(struct wmWindow *win); -void WM_timecursor (struct wmWindow *win, int nr); +void WM_cursor_grab_enable(struct wmWindow *win, int wrap, int hide, int *bounds); +void WM_cursor_grab_disable(struct wmWindow *win); +void WM_cursor_time (struct wmWindow *win, int nr); void *WM_paint_cursor_activate(struct wmWindowManager *wm, int (*poll)(struct bContext *C), @@ -243,11 +244,11 @@ void WM_operator_bl_idname(char *to, const char *from); void WM_operator_py_idname(char *to, const char *from); /* *************** menu types ******************** */ -void WM_menutype_init(void); -struct MenuType *WM_menutype_find(const char *idname, int quiet); -int WM_menutype_add(struct MenuType* mt); -void WM_menutype_freelink(struct MenuType* mt); -void WM_menutype_free(void); +void WM_menutype_init(void); +struct MenuType *WM_menutype_find(const char *idname, int quiet); +int WM_menutype_add(struct MenuType* mt); +void WM_menutype_freelink(struct MenuType* mt); +void WM_menutype_free(void); /* default operator callbacks for border/circle/lasso */ int WM_border_select_invoke (struct bContext *C, struct wmOperator *op, struct wmEvent *event); @@ -297,7 +298,7 @@ void wmOrtho (float x1, float x2, float y1, float y2, float n, float f); void wmOrtho2 (float x1, float x2, float y1, float y2); /* utilities */ -void WM_set_framebuffer_index_color(int index); +void WM_framebuffer_index_set(int index); int WM_framebuffer_to_index(unsigned int col); /* threaded Jobs Manager */ @@ -313,8 +314,8 @@ float WM_jobs_progress(struct wmWindowManager *wm, void *owner); char *WM_jobs_name(struct wmWindowManager *wm, void *owner); int WM_jobs_is_running(struct wmJob *); -void * WM_jobs_get_customdata(struct wmJob *); -void WM_jobs_customdata(struct wmJob *, void *customdata, void (*free)(void *)); +void * WM_jobs_customdata_get(struct wmJob *); +void WM_jobs_customdata_set(struct wmJob *, void *customdata, void (*free)(void *)); void WM_jobs_timer(struct wmJob *, double timestep, unsigned int note, unsigned int endnote); void WM_jobs_callbacks(struct wmJob *, void (*startjob)(void *, short *, short *, float *), diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 43435ce67e9..8d7dc21d95b 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -28,6 +28,9 @@ * \ingroup wm */ +#ifndef __WM_TYPES_H__ +#define __WM_TYPES_H__ + /* * Overview of WM structs * ====================== @@ -95,9 +98,6 @@ * */ -#ifndef __WM_TYPES_H__ -#define __WM_TYPES_H__ - #ifdef __cplusplus extern "C" { #endif diff --git a/source/blender/windowmanager/intern/wm_apple.c b/source/blender/windowmanager/intern/wm_apple.c index 71d074e340f..a7bd43986dd 100644 --- a/source/blender/windowmanager/intern/wm_apple.c +++ b/source/blender/windowmanager/intern/wm_apple.c @@ -124,14 +124,14 @@ void wm_set_apple_prefsize(int scr_x, int scr_y) short top, left, bottom, right; getMacAvailableBounds(&top, &left, &bottom, &right); - WM_setprefsize(left + 10, scr_y - bottom + 10, right - left - 20, bottom - 64); + WM_init_state_size_set(left + 10, scr_y - bottom + 10, right - left - 20, bottom - 64); G.windowstate = 0; } else { /* 40 + 684 + (headers) 22 + 22 = 768, the powerbook screen height */ - WM_setprefsize(120, 40, 850, 684); + WM_init_state_size_set(120, 40, 850, 684); G.windowstate = 0; } } diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c index bb985802e23..6fc6a57ade1 100644 --- a/source/blender/windowmanager/intern/wm_cursors.c +++ b/source/blender/windowmanager/intern/wm_cursors.c @@ -179,7 +179,7 @@ void WM_cursor_wait(int val) } } -void WM_cursor_grab(wmWindow *win, int wrap, int hide, int *bounds) +void WM_cursor_grab_enable(wmWindow *win, int wrap, int hide, int *bounds) { /* Only grab cursor when not running debug. * It helps not to get a stuck WM when hitting a breakpoint @@ -202,7 +202,7 @@ void WM_cursor_grab(wmWindow *win, int wrap, int hide, int *bounds) } } -void WM_cursor_ungrab(wmWindow *win) +void WM_cursor_grab_disable(wmWindow *win) { if ((G.debug & G_DEBUG) == 0) { if (win && win->ghostwin) { @@ -239,7 +239,7 @@ int wm_cursor_arrow_move(wmWindow *win, wmEvent *event) /* afer this you can call restore too */ -void WM_timecursor(wmWindow *win, int nr) +void WM_cursor_time(wmWindow *win, int nr) { /* 10 8x8 digits */ static char number_bitmaps[10][8] = { diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index e3ad425d0f8..10a383df5c9 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -938,7 +938,7 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, } } - WM_cursor_grab(CTX_wm_window(C), wrap, FALSE, bounds); + WM_cursor_grab_enable(CTX_wm_window(C), wrap, FALSE, bounds); } /* cancel UI handlers, typically tooltips that can hang around @@ -1202,7 +1202,7 @@ void WM_event_remove_handlers(bContext *C, ListBase *handlers) CTX_wm_region_set(C, region); } - WM_cursor_ungrab(CTX_wm_window(C)); + WM_cursor_grab_disable(CTX_wm_window(C)); WM_operator_free(handler->op); } else if (handler->ui_remove) { @@ -1432,7 +1432,7 @@ static int wm_handler_operator_call(bContext *C, ListBase *handlers, wmEventHand /* remove modal handler, operator itself should have been canceled and freed */ if (retval & (OPERATOR_CANCELLED | OPERATOR_FINISHED)) { - WM_cursor_ungrab(CTX_wm_window(C)); + WM_cursor_grab_disable(CTX_wm_window(C)); BLI_remlink(handlers, handler); wm_event_free_handler(handler); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index d4b55677af1..660117de9f7 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -356,7 +356,7 @@ static int wm_read_exotic(Scene *UNUSED(scene), const char *name) return retval; } -void WM_read_file(bContext *C, const char *filepath, ReportList *reports) +void WM_file_read(bContext *C, const char *filepath, ReportList *reports) { int retval; @@ -485,7 +485,7 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports) /* called on startup, (context entirely filled with NULLs) */ /* or called for 'New File' */ /* op can be NULL */ -int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory) +int WM_homefile_read(bContext *C, ReportList *UNUSED(reports), short from_memory) { ListBase wmbase; char tstr[FILE_MAX]; @@ -580,10 +580,10 @@ int WM_read_homefile(bContext *C, ReportList *UNUSED(reports), short from_memory return TRUE; } -int WM_read_homefile_exec(bContext *C, wmOperator *op) +int WM_homefile_read_exec(bContext *C, wmOperator *op) { int from_memory = strcmp(op->type->idname, "WM_OT_read_factory_settings") == 0; - return WM_read_homefile(C, op->reports, from_memory) ? OPERATOR_FINISHED : OPERATOR_CANCELLED; + return WM_homefile_read(C, op->reports, from_memory) ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } void WM_read_history(void) @@ -758,7 +758,7 @@ int write_crash_blend(void) } } -int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *reports, int copy) +int WM_file_write(bContext *C, const char *target, int fileflags, ReportList *reports, int copy) { Library *li; int len; @@ -857,7 +857,7 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re } /* operator entry */ -int WM_write_homefile(bContext *C, wmOperator *op) +int WM_homefile_write_exec(bContext *C, wmOperator *op) { wmWindowManager *wm = CTX_wm_manager(C); wmWindow *win = CTX_wm_window(C); @@ -995,6 +995,6 @@ void wm_autosave_read(bContext *C, ReportList *reports) char filename[FILE_MAX]; wm_autosave_location(filename); - WM_read_file(C, filename, reports); + WM_file_read(C, filename, reports); } diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 8ea644d6e5c..ac9b44fddb0 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -152,7 +152,7 @@ void WM_init(bContext *C, int argc, const char **argv) BLI_init_srgb_conversion(); /* get the default database, plus a wm */ - WM_read_homefile(C, NULL, G.factory_startup); + WM_homefile_read(C, NULL, G.factory_startup); BLF_lang_set(NULL); @@ -161,7 +161,7 @@ void WM_init(bContext *C, int argc, const char **argv) * initializing space types and other internal data. * * However cant redo this at the moment. Solution is to load python - * before WM_read_homefile() or make py-drivers check if python is running. + * before WM_homefile_read() or make py-drivers check if python is running. * Will try fix when the crash can be repeated. - campbell. */ #ifdef WITH_PYTHON diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c index bd7b4694471..ce0c7e13454 100644 --- a/source/blender/windowmanager/intern/wm_jobs.c +++ b/source/blender/windowmanager/intern/wm_jobs.c @@ -209,7 +209,7 @@ int WM_jobs_is_running(wmJob *steve) return steve->running; } -void *WM_jobs_get_customdata(wmJob *steve) +void *WM_jobs_customdata_get(wmJob *steve) { if (!steve->customdata) { return steve->run_customdata; @@ -219,7 +219,7 @@ void *WM_jobs_get_customdata(wmJob *steve) } } -void WM_jobs_customdata(wmJob *steve, void *customdata, void (*free)(void *)) +void WM_jobs_customdata_set(wmJob *steve, void *customdata, void (*free)(void *)) { /* pending job? just free */ if (steve->customdata) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 52436b6564c..59e0614b18a 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -326,7 +326,7 @@ static int wm_macro_modal(bContext *C, wmOperator *op, wmEvent *event) } } - WM_cursor_grab(CTX_wm_window(C), wrap, FALSE, bounds); + WM_cursor_grab_enable(CTX_wm_window(C), wrap, FALSE, bounds); } } } @@ -1575,7 +1575,7 @@ static void WM_OT_save_homefile(wmOperatorType *ot) ot->description = "Make the current file the default .blend file"; ot->invoke = WM_operator_confirm; - ot->exec = WM_write_homefile; + ot->exec = WM_homefile_write_exec; ot->poll = WM_operator_winactive; } @@ -1586,7 +1586,7 @@ static void WM_OT_read_homefile(wmOperatorType *ot) ot->description = "Open the default file (doesn't save the current file)"; ot->invoke = WM_operator_confirm; - ot->exec = WM_read_homefile_exec; + ot->exec = WM_homefile_read_exec; /* ommit poll to run in background mode */ } @@ -1597,7 +1597,7 @@ static void WM_OT_read_factory_settings(wmOperatorType *ot) ot->description = "Load default file and user preferences"; ot->invoke = WM_operator_confirm; - ot->exec = WM_read_homefile_exec; + ot->exec = WM_homefile_read_exec; /* ommit poll to run in background mode */ } @@ -1664,11 +1664,11 @@ static int wm_open_mainfile_exec(bContext *C, wmOperator *op) else G.f &= ~G_SCRIPT_AUTOEXEC; - /* XXX wm in context is not set correctly after WM_read_file -> crash */ + /* XXX wm in context is not set correctly after WM_file_read -> crash */ /* do it before for now, but is this correct with multiple windows? */ WM_event_add_notifier(C, NC_WINDOW, NULL); - WM_read_file(C, path, op->reports); + WM_file_read(C, path, op->reports); return OPERATOR_FINISHED; } @@ -1895,13 +1895,13 @@ static int wm_recover_last_session_exec(bContext *C, wmOperator *op) G.fileflags |= G_FILE_RECOVER; - /* XXX wm in context is not set correctly after WM_read_file -> crash */ + /* XXX wm in context is not set correctly after WM_file_read -> crash */ /* do it before for now, but is this correct with multiple windows? */ WM_event_add_notifier(C, NC_WINDOW, NULL); /* load file */ BLI_make_file_string("/", filename, BLI_temporary_dir(), "quit.blend"); - WM_read_file(C, filename, op->reports); + WM_file_read(C, filename, op->reports); G.fileflags &= ~G_FILE_RECOVER; return OPERATOR_FINISHED; @@ -1927,12 +1927,12 @@ static int wm_recover_auto_save_exec(bContext *C, wmOperator *op) G.fileflags |= G_FILE_RECOVER; - /* XXX wm in context is not set correctly after WM_read_file -> crash */ + /* XXX wm in context is not set correctly after WM_file_read -> crash */ /* do it before for now, but is this correct with multiple windows? */ WM_event_add_notifier(C, NC_WINDOW, NULL); /* load file */ - WM_read_file(C, path, op->reports); + WM_file_read(C, path, op->reports); G.fileflags &= ~G_FILE_RECOVER; @@ -2047,7 +2047,7 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op) } #endif - if (WM_write_file(C, path, fileflags, op->reports, copy) != 0) + if (WM_file_write(C, path, fileflags, op->reports, copy) != 0) return OPERATOR_CANCELLED; WM_event_add_notifier(C, NC_WM | ND_FILESAVE, NULL); diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c index 529910d220e..c9fb2644cfa 100644 --- a/source/blender/windowmanager/intern/wm_subwindow.c +++ b/source/blender/windowmanager/intern/wm_subwindow.c @@ -376,7 +376,7 @@ unsigned int index_to_framebuffer(int index) #endif -void WM_set_framebuffer_index_color(int index) +void WM_framebuffer_index_set(int index) { const int col = index_to_framebuffer(index); cpack(col); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 28e50f1655e..c2aa99352e9 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -1202,7 +1202,7 @@ void wm_get_cursor_position(wmWindow *win, int *x, int *y) /* called whem no ghost system was initialized */ -void WM_setprefsize(int stax, int stay, int sizx, int sizy) +void WM_init_state_size_set(int stax, int stay, int sizx, int sizy) { wm_init_state.start_x = stax; /* left hand pos */ wm_init_state.start_y = stay; /* bottom pos */ @@ -1212,13 +1212,13 @@ void WM_setprefsize(int stax, int stay, int sizx, int sizy) } /* for borderless and border windows set from command-line */ -void WM_setinitialstate_fullscreen(void) +void WM_init_state_fullscreen_set(void) { wm_init_state.windowstate = GHOST_kWindowStateFullScreen; wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE; } -void WM_setinitialstate_normal(void) +void WM_init_state_normal_set(void) { wm_init_state.windowstate = GHOST_kWindowStateNormal; wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE; -- cgit v1.2.3