forked from bartvdbraak/blender
code cleanup: WM naming conventions
This commit is contained in:
parent
f2d06dc257
commit
c567cf3fab
@ -344,7 +344,7 @@ protected:
|
||||
static HDC s_firstHDC;
|
||||
/** Flag for if window has captured the mouse */
|
||||
bool m_hasMouseCaptured;
|
||||
/** Flag if an operator grabs the mouse with WM_cursor_grab/ungrab()
|
||||
/** Flag if an operator grabs the mouse with WM_cursor_grab_enable/ungrab()
|
||||
* Multiple grabs must be realesed with a single ungrab*/
|
||||
bool m_hasGrabMouse;
|
||||
/** Count of number of pressed buttons */
|
||||
|
@ -5222,13 +5222,13 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
|
||||
/* number editing */
|
||||
if (state == BUTTON_STATE_NUM_EDITING) {
|
||||
if (ui_is_a_warp_but(but))
|
||||
WM_cursor_grab(CTX_wm_window(C), TRUE, TRUE, NULL);
|
||||
WM_cursor_grab_enable(CTX_wm_window(C), TRUE, TRUE, NULL);
|
||||
ui_numedit_begin(but, data);
|
||||
}
|
||||
else if (data->state == BUTTON_STATE_NUM_EDITING) {
|
||||
ui_numedit_end(but, data);
|
||||
if (ui_is_a_warp_but(but))
|
||||
WM_cursor_ungrab(CTX_wm_window(C));
|
||||
WM_cursor_grab_disable(CTX_wm_window(C));
|
||||
}
|
||||
/* menu open */
|
||||
if (state == BUTTON_STATE_MENU_OPEN)
|
||||
|
@ -521,7 +521,7 @@ int paintface_mouse_select(struct bContext *C, Object *ob, const int mval[2], in
|
||||
if (!facesel_face_pick(C, me, ob, mval, &index, 1))
|
||||
return 0;
|
||||
|
||||
if (index >= me->totpoly || index < 0)
|
||||
if (index >= me->totpoly)
|
||||
return 0;
|
||||
|
||||
mpoly_sel = me->mpoly + index;
|
||||
|
@ -1256,7 +1256,7 @@ static int multiresbake_image_exec(bContext *C, wmOperator *op)
|
||||
|
||||
/* setup job */
|
||||
steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Multires Bake", WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS);
|
||||
WM_jobs_customdata(steve, bkr, multiresbake_freejob);
|
||||
WM_jobs_customdata_set(steve, bkr, multiresbake_freejob);
|
||||
WM_jobs_timer(steve, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
|
||||
WM_jobs_callbacks(steve, multiresbake_startjob, NULL, NULL, NULL);
|
||||
|
||||
@ -1483,7 +1483,7 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
|
||||
|
||||
/* setup job */
|
||||
steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Texture Bake", WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS);
|
||||
WM_jobs_customdata(steve, bkr, bake_freejob);
|
||||
WM_jobs_customdata_set(steve, bkr, bake_freejob);
|
||||
WM_jobs_timer(steve, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
|
||||
WM_jobs_callbacks(steve, bake_startjob, NULL, bake_update, NULL);
|
||||
|
||||
|
@ -2187,7 +2187,7 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
|
||||
oj->och = och;
|
||||
oj->omd = omd;
|
||||
|
||||
WM_jobs_customdata(steve, oj, oceanbake_free);
|
||||
WM_jobs_customdata_set(steve, oj, oceanbake_free);
|
||||
WM_jobs_timer(steve, 0.1, NC_OBJECT | ND_MODIFIER, NC_OBJECT | ND_MODIFIER);
|
||||
WM_jobs_callbacks(steve, oceanbake_startjob, NULL, NULL, oceanbake_endjob);
|
||||
|
||||
|
@ -299,7 +299,7 @@ static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surf
|
||||
if (blender_test_break()) return 0;
|
||||
|
||||
/* Update progress bar cursor */
|
||||
WM_timecursor(win, (int)progress);
|
||||
WM_cursor_time(win, (int)progress);
|
||||
|
||||
/* calculate a frame */
|
||||
scene->r.cfra = (int)frame;
|
||||
|
@ -1071,7 +1071,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
|
||||
wmJob *steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Fluid Simulation", WM_JOB_PROGRESS);
|
||||
|
||||
/* setup job */
|
||||
WM_jobs_customdata(steve, fb, fluidbake_free);
|
||||
WM_jobs_customdata_set(steve, fb, fluidbake_free);
|
||||
WM_jobs_timer(steve, 0.1, NC_SCENE|ND_FRAME, NC_SCENE|ND_FRAME);
|
||||
WM_jobs_callbacks(steve, fluidbake_startjob, NULL, NULL, fluidbake_endjob);
|
||||
|
||||
|
@ -111,7 +111,7 @@ static int ptcache_bake_all_exec(bContext *C, wmOperator *op)
|
||||
* and pointcache baking will be reimplemented with
|
||||
* the job system soon anyways. */
|
||||
if (win) {
|
||||
baker.progressbar = (void (*)(void *, int))WM_timecursor;
|
||||
baker.progressbar = (void (*)(void *, int))WM_cursor_time;
|
||||
baker.progressend = (void (*)(void *))WM_cursor_restore;
|
||||
baker.progresscontext = win;
|
||||
}
|
||||
@ -215,7 +215,7 @@ static int ptcache_bake_exec(bContext *C, wmOperator *op)
|
||||
* and pointcache baking will be reimplemented with
|
||||
* the job system soon anyways. */
|
||||
if (win) {
|
||||
baker.progressbar = (void (*)(void *, int))WM_timecursor;
|
||||
baker.progressbar = (void (*)(void *, int))WM_cursor_time;
|
||||
baker.progressend = (void (*)(void *))WM_cursor_restore;
|
||||
baker.progresscontext = win;
|
||||
}
|
||||
|
@ -565,7 +565,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
||||
else name = "Render";
|
||||
|
||||
steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, name, jobflag);
|
||||
WM_jobs_customdata(steve, rj, render_freejob);
|
||||
WM_jobs_customdata_set(steve, rj, render_freejob);
|
||||
WM_jobs_timer(steve, 0.2, NC_SCENE | ND_RENDER_RESULT, 0);
|
||||
WM_jobs_callbacks(steve, render_startjob, NULL, NULL, render_endjob);
|
||||
|
||||
|
@ -1031,7 +1031,7 @@ void ED_preview_icon_job(const bContext *C, void *owner, ID *id, unsigned int *r
|
||||
ip = MEM_callocN(sizeof(IconPreview), "icon preview");
|
||||
|
||||
/* render all resolutions from suspended job too */
|
||||
old_ip = WM_jobs_get_customdata(steve);
|
||||
old_ip = WM_jobs_customdata_get(steve);
|
||||
if (old_ip)
|
||||
BLI_movelisttolist(&ip->sizes, &old_ip->sizes);
|
||||
|
||||
@ -1043,7 +1043,7 @@ void ED_preview_icon_job(const bContext *C, void *owner, ID *id, unsigned int *r
|
||||
icon_preview_add_size(ip, rect, sizex, sizey);
|
||||
|
||||
/* setup job */
|
||||
WM_jobs_customdata(steve, ip, icon_preview_free);
|
||||
WM_jobs_customdata_set(steve, ip, icon_preview_free);
|
||||
WM_jobs_timer(steve, 0.25, NC_MATERIAL, NC_MATERIAL);
|
||||
WM_jobs_callbacks(steve, icon_preview_startjob_all_sizes, NULL, NULL, icon_preview_endjob);
|
||||
|
||||
@ -1072,7 +1072,7 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
|
||||
else sp->col[0] = sp->col[1] = sp->col[2] = sp->col[3] = 1.0f;
|
||||
|
||||
/* setup job */
|
||||
WM_jobs_customdata(steve, sp, shader_preview_free);
|
||||
WM_jobs_customdata_set(steve, sp, shader_preview_free);
|
||||
WM_jobs_timer(steve, 0.1, NC_MATERIAL, NC_MATERIAL);
|
||||
WM_jobs_callbacks(steve, common_preview_startjob, NULL, shader_preview_updatejob, NULL);
|
||||
|
||||
|
@ -420,7 +420,7 @@ static int screencast_exec(bContext *C, wmOperator *op)
|
||||
BKE_reports_init(&sj->reports, RPT_PRINT);
|
||||
|
||||
/* setup job */
|
||||
WM_jobs_customdata(steve, sj, screenshot_freejob);
|
||||
WM_jobs_customdata_set(steve, sj, screenshot_freejob);
|
||||
WM_jobs_timer(steve, 0.1, 0, NC_SCREEN | ND_SCREENCAST);
|
||||
WM_jobs_callbacks(steve, screenshot_startjob, NULL, screenshot_updatejob, NULL);
|
||||
|
||||
|
@ -1054,7 +1054,7 @@ static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
clip->proxy.build_size_flag, clip->proxy.quality);
|
||||
}
|
||||
|
||||
WM_jobs_customdata(steve, pj, proxy_freejob);
|
||||
WM_jobs_customdata_set(steve, pj, proxy_freejob);
|
||||
WM_jobs_timer(steve, 0.2, NC_MOVIECLIP | ND_DISPLAY, 0);
|
||||
WM_jobs_callbacks(steve, proxy_startjob, NULL, NULL, proxy_endjob);
|
||||
|
||||
|
@ -1262,7 +1262,7 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
|
||||
|
||||
/* setup job */
|
||||
steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Track Markers", WM_JOB_PROGRESS);
|
||||
WM_jobs_customdata(steve, tmj, track_markers_freejob);
|
||||
WM_jobs_customdata_set(steve, tmj, track_markers_freejob);
|
||||
|
||||
/* if there's delay set in tracking job, tracking should happen
|
||||
* with fixed FPS. To deal with editor refresh we have to synchronize
|
||||
@ -1493,7 +1493,7 @@ static int solve_camera_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
|
||||
|
||||
/* setup job */
|
||||
steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Solve Camera", WM_JOB_PROGRESS);
|
||||
WM_jobs_customdata(steve, scj, solve_camera_freejob);
|
||||
WM_jobs_customdata_set(steve, scj, solve_camera_freejob);
|
||||
WM_jobs_timer(steve, 0.1, NC_MOVIECLIP | NA_EVALUATED, 0);
|
||||
WM_jobs_callbacks(steve, solve_camera_startjob, NULL, solve_camera_updatejob, NULL);
|
||||
|
||||
|
@ -1369,7 +1369,7 @@ void thumbnails_start(struct FileList *filelist, const struct bContext *C)
|
||||
|
||||
/* setup job */
|
||||
steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), filelist, "Thumbnails", 0);
|
||||
WM_jobs_customdata(steve, tj, thumbnails_free);
|
||||
WM_jobs_customdata_set(steve, tj, thumbnails_free);
|
||||
WM_jobs_timer(steve, 0.5, NC_WINDOW, NC_WINDOW);
|
||||
WM_jobs_callbacks(steve, thumbnails_startjob, NULL, thumbnails_update, NULL);
|
||||
|
||||
|
@ -2252,7 +2252,7 @@ static int image_record_composite_apply(bContext *C, wmOperator *op)
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ImBuf *ibuf;
|
||||
|
||||
WM_timecursor(CTX_wm_window(C), scene->r.cfra);
|
||||
WM_cursor_time(CTX_wm_window(C), scene->r.cfra);
|
||||
|
||||
// XXX scene->nodetree->test_break= blender_test_break;
|
||||
// XXX scene->nodetree->test_break= NULL;
|
||||
|
@ -189,7 +189,7 @@ void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene
|
||||
cj->ntree = nodetree;
|
||||
|
||||
/* setup job */
|
||||
WM_jobs_customdata(steve, cj, compo_freejob);
|
||||
WM_jobs_customdata_set(steve, cj, compo_freejob);
|
||||
WM_jobs_timer(steve, 0.1, NC_SCENE, NC_SCENE | ND_COMPO_RESULT);
|
||||
WM_jobs_callbacks(steve, compo_startjob, compo_initjob, compo_updatejob, NULL);
|
||||
|
||||
|
@ -188,7 +188,7 @@ static void seq_proxy_build_job(const bContext *C)
|
||||
|
||||
steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Building Proxies", WM_JOB_PROGRESS);
|
||||
|
||||
pj = WM_jobs_get_customdata(steve);
|
||||
pj = WM_jobs_customdata_get(steve);
|
||||
|
||||
if (!pj) {
|
||||
pj = MEM_callocN(sizeof(ProxyJob), "proxy rebuild job");
|
||||
@ -196,7 +196,7 @@ static void seq_proxy_build_job(const bContext *C)
|
||||
pj->scene = scene;
|
||||
pj->main = CTX_data_main(C);
|
||||
|
||||
WM_jobs_customdata(steve, pj, proxy_freejob);
|
||||
WM_jobs_customdata_set(steve, pj, proxy_freejob);
|
||||
WM_jobs_timer(steve, 0.1, NC_SCENE | ND_SEQUENCER, NC_SCENE | ND_SEQUENCER);
|
||||
WM_jobs_callbacks(steve, proxy_startjob, NULL, NULL, proxy_endjob);
|
||||
}
|
||||
|
@ -7277,7 +7277,7 @@ static void bbs_obmode_mesh_verts__mapFunc(void *userData, int index, const floa
|
||||
int offset = (intptr_t) data->offset;
|
||||
|
||||
if (!(mv->flag & ME_HIDE)) {
|
||||
WM_set_framebuffer_index_color(offset + index);
|
||||
WM_framebuffer_index_set(offset + index);
|
||||
bglVertex3fv(co);
|
||||
}
|
||||
}
|
||||
@ -7304,7 +7304,7 @@ static void bbs_mesh_verts__mapFunc(void *userData, int index, const float co[3]
|
||||
BMVert *eve = EDBM_vert_at_index(ptrs[1], index);
|
||||
|
||||
if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) {
|
||||
WM_set_framebuffer_index_color(offset + index);
|
||||
WM_framebuffer_index_set(offset + index);
|
||||
bglVertex3fv(co);
|
||||
}
|
||||
}
|
||||
@ -7326,7 +7326,7 @@ static DMDrawOption bbs_mesh_wire__setDrawOptions(void *userData, int index)
|
||||
BMEdge *eed = EDBM_edge_at_index(ptrs[1], index);
|
||||
|
||||
if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
|
||||
WM_set_framebuffer_index_color(offset + index);
|
||||
WM_framebuffer_index_set(offset + index);
|
||||
return DM_DRAW_OPTION_NORMAL;
|
||||
}
|
||||
else {
|
||||
@ -7345,7 +7345,7 @@ static DMDrawOption bbs_mesh_solid__setSolidDrawOptions(void *userData, int inde
|
||||
|
||||
if (efa && !BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
|
||||
if (((void **)userData)[1]) {
|
||||
WM_set_framebuffer_index_color(index + 1);
|
||||
WM_framebuffer_index_set(index + 1);
|
||||
}
|
||||
return DM_DRAW_OPTION_NORMAL;
|
||||
}
|
||||
@ -7359,7 +7359,7 @@ static void bbs_mesh_solid__drawCenter(void *userData, int index, const float ce
|
||||
BMFace *efa = EDBM_face_at_index(((void **)userData)[0], index);
|
||||
|
||||
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
|
||||
WM_set_framebuffer_index_color(index + 1);
|
||||
WM_framebuffer_index_set(index + 1);
|
||||
|
||||
bglVertex3fv(cent);
|
||||
}
|
||||
@ -7392,7 +7392,7 @@ static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d,
|
||||
|
||||
static DMDrawOption bbs_mesh_solid__setDrawOpts(void *UNUSED(userData), int index)
|
||||
{
|
||||
WM_set_framebuffer_index_color(index + 1);
|
||||
WM_framebuffer_index_set(index + 1);
|
||||
return DM_DRAW_OPTION_NORMAL;
|
||||
}
|
||||
|
||||
@ -7401,7 +7401,7 @@ static DMDrawOption bbs_mesh_solid_hide__setDrawOpts(void *userData, int index)
|
||||
Mesh *me = userData;
|
||||
|
||||
if (!(me->mpoly[index].flag & ME_HIDE)) {
|
||||
WM_set_framebuffer_index_color(index + 1);
|
||||
WM_framebuffer_index_set(index + 1);
|
||||
return DM_DRAW_OPTION_NORMAL;
|
||||
}
|
||||
else {
|
||||
@ -7409,7 +7409,7 @@ static DMDrawOption bbs_mesh_solid_hide__setDrawOpts(void *userData, int index)
|
||||
}
|
||||
}
|
||||
|
||||
/* must have called WM_set_framebuffer_index_color beforehand */
|
||||
/* must have called WM_framebuffer_index_set beforehand */
|
||||
static DMDrawOption bbs_mesh_solid_hide2__setDrawOpts(void *userData, int index)
|
||||
{
|
||||
Mesh *me = userData;
|
||||
|
@ -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 *),
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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] = {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -480,20 +480,20 @@ static int prefsize(int argc, const char **argv, void *UNUSED(data))
|
||||
sizx = atoi(argv[3]);
|
||||
sizy = atoi(argv[4]);
|
||||
|
||||
WM_setprefsize(stax, stay, sizx, sizy);
|
||||
WM_init_state_size_set(stax, stay, sizx, sizy);
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
static int with_borders(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
|
||||
{
|
||||
WM_setinitialstate_normal();
|
||||
WM_init_state_normal_set();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int without_borders(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
|
||||
{
|
||||
WM_setinitialstate_fullscreen();
|
||||
WM_init_state_fullscreen_set();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1029,7 +1029,7 @@ static int load_file(int UNUSED(argc), const char **argv, void *data)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* WM_read_file() runs normally but since we're in background mode do here */
|
||||
/* WM_file_read() runs normally but since we're in background mode do here */
|
||||
#ifdef WITH_PYTHON
|
||||
/* run any texts that were loaded in and flagged as modules */
|
||||
BPY_driver_reset();
|
||||
@ -1046,7 +1046,7 @@ static int load_file(int UNUSED(argc), const char **argv, void *data)
|
||||
* a file - this should do everything a 'load file' does */
|
||||
ReportList reports;
|
||||
BKE_reports_init(&reports, RPT_PRINT);
|
||||
WM_read_file(C, filename, &reports);
|
||||
WM_file_read(C, filename, &reports);
|
||||
BKE_reports_clear(&reports);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user