forked from bartvdbraak/blender
style cleanup
This commit is contained in:
parent
bf4be941fc
commit
e903701450
@ -197,15 +197,15 @@ static char *keytype_to_string(GHOST_TKey key)
|
||||
|
||||
void event_to_buf(GHOST_EventHandle evt, char buf[128])
|
||||
{
|
||||
GHOST_TEventType type= GHOST_GetEventType(evt);
|
||||
double time= (double) ((GHOST_TInt64) GHOST_GetEventTime(evt))/1000;
|
||||
GHOST_WindowHandle win= GHOST_GetEventWindow(evt);
|
||||
void *data= GHOST_GetEventData(evt);
|
||||
char *pos= buf;
|
||||
GHOST_TEventType type = GHOST_GetEventType(evt);
|
||||
double time = (double) ((GHOST_TInt64) GHOST_GetEventTime(evt))/1000;
|
||||
GHOST_WindowHandle win = GHOST_GetEventWindow(evt);
|
||||
void *data = GHOST_GetEventData(evt);
|
||||
char *pos = buf;
|
||||
|
||||
pos += sprintf(pos, "event: %6.2f, %16s", time, eventtype_to_string(type));
|
||||
if (win) {
|
||||
char *s= GHOST_GetTitle(win);
|
||||
char *s = GHOST_GetTitle(win);
|
||||
pos += sprintf(pos, " - win: %s", s);
|
||||
free(s);
|
||||
}
|
||||
@ -215,14 +215,14 @@ void event_to_buf(GHOST_EventHandle evt, char buf[128])
|
||||
switch (type) {
|
||||
case GHOST_kEventCursorMove:
|
||||
{
|
||||
GHOST_TEventCursorData *cd= data;
|
||||
GHOST_TEventCursorData *cd = data;
|
||||
pos += sprintf(pos, " - pos: (%d, %d)", cd->x, cd->y);
|
||||
break;
|
||||
}
|
||||
case GHOST_kEventButtonDown:
|
||||
case GHOST_kEventButtonUp:
|
||||
{
|
||||
GHOST_TEventButtonData *bd= data;
|
||||
GHOST_TEventButtonData *bd = data;
|
||||
pos += sprintf(pos, " - but: %d", bd->button);
|
||||
break;
|
||||
}
|
||||
@ -230,7 +230,7 @@ void event_to_buf(GHOST_EventHandle evt, char buf[128])
|
||||
case GHOST_kEventKeyDown:
|
||||
case GHOST_kEventKeyUp:
|
||||
{
|
||||
GHOST_TEventKeyData *kd= data;
|
||||
GHOST_TEventKeyData *kd = data;
|
||||
pos += sprintf(pos, " - key: %s (%d)", keytype_to_string(kd->key), kd->key);
|
||||
if (kd->ascii) pos+= sprintf(pos, " ascii: '%c' (%d)", kd->ascii, kd->ascii);
|
||||
break;
|
||||
|
@ -113,7 +113,7 @@ static void preprocess_all_edges(struct r_FillContext *ctx,
|
||||
ctx->rb.xmin = xbeg;
|
||||
}
|
||||
if (ybeg >= ctx->rb.ymax) {
|
||||
ctx->rb.ymax= ybeg;
|
||||
ctx->rb.ymax = ybeg;
|
||||
}
|
||||
else if (ybeg <= ctx->rb.ymin) {
|
||||
ctx->rb.ymin=ybeg;
|
||||
|
@ -49,7 +49,6 @@ char *BLI_str_prev_char_utf8(const char *p);
|
||||
|
||||
/* wchar_t functions, copied from blenders own font.c originally */
|
||||
size_t BLI_wstrlen_utf8(const wchar_t *src);
|
||||
size_t BLI_strlen_utf8_char(const char *strc);
|
||||
size_t BLI_strlen_utf8(const char *strc);
|
||||
size_t BLI_strlen_range_utf8(const char *start, const char *end);
|
||||
size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst, const wchar_t *__restrict src, const size_t maxcpy);
|
||||
|
@ -231,8 +231,9 @@ size_t BLI_wstrlen_utf8(const wchar_t *src)
|
||||
return len;
|
||||
}
|
||||
|
||||
/* this is very close to 'BLI_str_utf8_size' functionality, perhaps we should de-duplicate */
|
||||
/* size of UTF-8 character in bytes */
|
||||
size_t BLI_strlen_utf8_char(const char *strc)
|
||||
static size_t strlen_utf8_char(const char *strc)
|
||||
{
|
||||
if ((*strc & 0xe0) == 0xc0) {
|
||||
if ((strc[1] & 0x80) && (strc[1] & 0x40) == 0x00)
|
||||
@ -255,7 +256,7 @@ size_t BLI_strlen_utf8(const char *strc)
|
||||
int len;
|
||||
|
||||
for (len = 0; *strc; len++)
|
||||
strc += BLI_strlen_utf8_char(strc);
|
||||
strc += strlen_utf8_char(strc);
|
||||
|
||||
return len;
|
||||
}
|
||||
@ -266,7 +267,7 @@ size_t BLI_strlen_range_utf8(const char *start, const char *end)
|
||||
int len;
|
||||
|
||||
for (len = 0; strc < end; len++)
|
||||
strc += BLI_strlen_utf8_char(strc);
|
||||
strc += strlen_utf8_char(strc);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ void ANIM_OT_keyingset_button_remove(wmOperatorType *ot)
|
||||
|
||||
/* callbacks */
|
||||
ot->exec = remove_keyingset_button_exec;
|
||||
//op->poll= ???
|
||||
//op->poll = ???
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
@ -1337,7 +1337,7 @@ void ui_button_text_password_hide(char password_str[UI_MAX_DRAW_STR], uiBut *but
|
||||
BLI_strncpy(but->drawstr, password_str, UI_MAX_DRAW_STR);
|
||||
|
||||
/* remap cursor positions */
|
||||
if(but->pos >= 0) {
|
||||
if (but->pos >= 0) {
|
||||
but->pos = ui_text_position_from_hidden(but, but->pos);
|
||||
but->selsta = ui_text_position_from_hidden(but, but->selsta);
|
||||
but->selend = ui_text_position_from_hidden(but, but->selend);
|
||||
@ -1348,7 +1348,7 @@ void ui_button_text_password_hide(char password_str[UI_MAX_DRAW_STR], uiBut *but
|
||||
int i, len = BLI_strlen_utf8(but->drawstr);
|
||||
|
||||
/* remap cursor positions */
|
||||
if(but->pos >= 0) {
|
||||
if (but->pos >= 0) {
|
||||
but->pos = ui_text_position_to_hidden(but, but->pos);
|
||||
but->selsta = ui_text_position_to_hidden(but, but->selsta);
|
||||
but->selend = ui_text_position_to_hidden(but, but->selend);
|
||||
|
@ -203,7 +203,7 @@ static void file_panel_operator(const bContext *C, Panel *pa)
|
||||
{
|
||||
SpaceFile *sfile = CTX_wm_space_file(C);
|
||||
wmOperator *op = sfile->op;
|
||||
// int empty= 1, flag;
|
||||
// int empty = 1, flag;
|
||||
|
||||
uiBlockSetFunc(uiLayoutGetBlock(pa->layout), file_draw_check_cb, NULL, NULL);
|
||||
|
||||
|
@ -420,7 +420,7 @@ static short apply_targetless_ik(Object *ob)
|
||||
float rmat[4][4] /*, tmat[4][4], imat[4][4]*/;
|
||||
|
||||
/* pose_mat(b) = pose_mat(b-1) * offs_bone * channel * constraint * IK */
|
||||
/* we put in channel the entire result of rmat= (channel * constraint * IK) */
|
||||
/* we put in channel the entire result of rmat = (channel * constraint * IK) */
|
||||
/* pose_mat(b) = pose_mat(b-1) * offs_bone * rmat */
|
||||
/* rmat = pose_mat(b) * inv(pose_mat(b-1) * offs_bone ) */
|
||||
|
||||
@ -4642,7 +4642,7 @@ static void set_trans_object_base_flags(TransInfo *t)
|
||||
|
||||
/*
|
||||
* if Base selected and has parent selected:
|
||||
* base->flag= BA_WAS_SEL
|
||||
* base->flag = BA_WAS_SEL
|
||||
*/
|
||||
Base *base;
|
||||
|
||||
|
@ -43,8 +43,7 @@ typedef struct SunSky {
|
||||
|
||||
float perez_Y[5], perez_x[5], perez_y[5];
|
||||
|
||||
/* suggested by glome in
|
||||
* http://projects.blender.org/tracker/?func=detail&atid=127&aid=8063&group_id=9*/
|
||||
/* suggested by glome in patch [#8063] */
|
||||
float horizon_brightness;
|
||||
float spread;
|
||||
float sun_brightness;
|
||||
|
@ -217,8 +217,7 @@ void InitSunSky(struct SunSky *sunsky, float turb, const float toSun[3], float h
|
||||
sunsky->perez_y[3] = -0.04405f * T - 1.65369f;
|
||||
sunsky->perez_y[4] = -0.01092f * T + 0.05291f;
|
||||
|
||||
/* suggested by glome in
|
||||
* http://projects.blender.org/tracker/?func=detail&atid=127&aid=8063&group_id=9*/
|
||||
/* suggested by glome in patch [#8063] */
|
||||
sunsky->perez_Y[0] *= sunsky->horizon_brightness;
|
||||
sunsky->perez_x[0] *= sunsky->horizon_brightness;
|
||||
sunsky->perez_y[0] *= sunsky->horizon_brightness;
|
||||
|
@ -1866,7 +1866,7 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
|
||||
|
||||
if (win && win->eventstate->prevtype == event->type) {
|
||||
|
||||
if(event->val == KM_RELEASE && win->eventstate->prevval == KM_PRESS) {
|
||||
if (event->val == KM_RELEASE && win->eventstate->prevval == KM_PRESS) {
|
||||
event->val = KM_CLICK;
|
||||
action |= wm_handlers_do_intern(C, event, handlers);
|
||||
|
||||
@ -1875,7 +1875,7 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers)
|
||||
event->val = KM_RELEASE;
|
||||
}
|
||||
}
|
||||
else if(event->val == KM_DBL_CLICK) {
|
||||
else if (event->val == KM_DBL_CLICK) {
|
||||
event->val = KM_PRESS;
|
||||
action |= wm_handlers_do_intern(C, event, handlers);
|
||||
|
||||
@ -2787,8 +2787,8 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
|
||||
event.type = MIDDLEMOUSE;
|
||||
|
||||
/* copy to event state */
|
||||
evt->val= event.val;
|
||||
evt->type= event.type;
|
||||
evt->val = event.val;
|
||||
evt->type = event.type;
|
||||
|
||||
if (win->active == 0) {
|
||||
int cx, cy;
|
||||
@ -2803,8 +2803,8 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
|
||||
/* double click test */
|
||||
if (event.type == evt->prevtype && event.val == KM_PRESS) {
|
||||
if ((ABS(event.x - evt->prevclickx)) <= 2 &&
|
||||
(ABS(event.y - evt->prevclicky)) <= 2 &&
|
||||
((PIL_check_seconds_timer() - evt->prevclicktime) * 1000 < U.dbl_click_time))
|
||||
(ABS(event.y - evt->prevclicky)) <= 2 &&
|
||||
((PIL_check_seconds_timer() - evt->prevclicktime) * 1000 < U.dbl_click_time))
|
||||
{
|
||||
event.val = KM_DBL_CLICK;
|
||||
}
|
||||
@ -2846,8 +2846,8 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
|
||||
event.val = (type == GHOST_kEventKeyDown) ? KM_PRESS : KM_RELEASE;
|
||||
|
||||
/* copy to event state */
|
||||
evt->val= event.val;
|
||||
evt->type= event.type;
|
||||
evt->val = event.val;
|
||||
evt->type = event.type;
|
||||
|
||||
/* exclude arrow keys, esc, etc from text input */
|
||||
if (type == GHOST_kEventKeyUp) {
|
||||
@ -2877,11 +2877,11 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
|
||||
/* double click test */
|
||||
if (event.type == evt->prevtype && event.val == KM_PRESS) {
|
||||
if ((ABS(event.x - evt->prevclickx)) <= 2 &&
|
||||
(ABS(event.y - evt->prevclicky)) <= 2 &&
|
||||
((PIL_check_seconds_timer() - evt->prevclicktime) * 1000 < U.dbl_click_time))
|
||||
(ABS(event.y - evt->prevclicky)) <= 2 &&
|
||||
((PIL_check_seconds_timer() - evt->prevclicktime) * 1000 < U.dbl_click_time))
|
||||
{
|
||||
// printf("double click\n");
|
||||
evt->val= event.val = KM_DBL_CLICK;
|
||||
evt->val = event.val = KM_DBL_CLICK;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2893,23 +2893,23 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U
|
||||
switch (event.type) {
|
||||
case LEFTSHIFTKEY: case RIGHTSHIFTKEY:
|
||||
event.shift = evt->shift = (event.val == KM_PRESS) ?
|
||||
((evt->ctrl || evt->alt || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) :
|
||||
FALSE;
|
||||
((evt->ctrl || evt->alt || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) :
|
||||
FALSE;
|
||||
break;
|
||||
case LEFTCTRLKEY: case RIGHTCTRLKEY:
|
||||
event.ctrl = evt->ctrl = (event.val == KM_PRESS) ?
|
||||
((evt->shift || evt->alt || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) :
|
||||
FALSE;
|
||||
((evt->shift || evt->alt || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) :
|
||||
FALSE;
|
||||
break;
|
||||
case LEFTALTKEY: case RIGHTALTKEY:
|
||||
event.alt = evt->alt = (event.val == KM_PRESS) ?
|
||||
((evt->ctrl || evt->shift || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) :
|
||||
FALSE;
|
||||
((evt->ctrl || evt->shift || evt->oskey) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) :
|
||||
FALSE;
|
||||
break;
|
||||
case OSKEY:
|
||||
event.oskey = evt->oskey = (event.val == KM_PRESS) ?
|
||||
((evt->ctrl || evt->alt || evt->shift) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) :
|
||||
FALSE;
|
||||
((evt->ctrl || evt->alt || evt->shift) ? (KM_MOD_FIRST | KM_MOD_SECOND) : KM_MOD_FIRST) :
|
||||
FALSE;
|
||||
break;
|
||||
default:
|
||||
if (event.val == KM_PRESS && event.keymodifier == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user