[Bf-blender-cvs] [b9114cb] master: UI: Use bool rather then int/short's where possible
Campbell Barton
noreply at git.blender.org
Sat Jan 4 08:10:54 CET 2014
Commit: b9114cb609698bdd40175b79c017b8ec8d10b518
Author: Campbell Barton
Date: Sat Jan 4 17:16:19 2014 +1100
https://developer.blender.org/rBb9114cb609698bdd40175b79c017b8ec8d10b518
UI: Use bool rather then int/short's where possible
===================================================================
M source/blender/blenkernel/BKE_colortools.h
M source/blender/blenkernel/BKE_context.h
M source/blender/blenkernel/BKE_text.h
M source/blender/blenkernel/BKE_unit.h
M source/blender/blenkernel/intern/colortools.c
M source/blender/blenkernel/intern/text.c
M source/blender/blenkernel/intern/unit.c
M source/blender/editors/interface/interface.c
M source/blender/editors/interface/interface_draw.c
M source/blender/editors/interface/interface_eyedropper.c
M source/blender/editors/interface/interface_handlers.c
M source/blender/editors/interface/interface_icons.c
M source/blender/editors/interface/interface_intern.h
M source/blender/editors/interface/interface_layout.c
M source/blender/editors/interface/interface_ops.c
M source/blender/editors/interface/interface_panel.c
M source/blender/editors/interface/interface_regions.c
M source/blender/editors/interface/interface_templates.c
M source/blender/editors/interface/interface_utils.c
M source/blender/editors/interface/interface_widgets.c
M source/blender/editors/interface/resources.c
M source/blender/editors/interface/view2d.c
M source/blender/editors/interface/view2d_ops.c
M source/blender/editors/transform/transform.c
M source/blender/editors/util/numinput.c
M source/blender/python/BPY_extern.h
M source/blender/python/intern/bpy_interface.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h
index e0b7e68..a69a960 100644
--- a/source/blender/blenkernel/BKE_colortools.h
+++ b/source/blender/blenkernel/BKE_colortools.h
@@ -59,7 +59,7 @@ int curvemap_remove_point(struct CurveMap *cuma, struct Curv
struct CurveMapPoint *curvemap_insert(struct CurveMap *cuma, float x, float y);
void curvemap_sethandle(struct CurveMap *cuma, int type);
-void curvemapping_changed(struct CurveMapping *cumap, int rem_doubles);
+void curvemapping_changed(struct CurveMapping *cumap, const bool rem_doubles);
void curvemapping_changed_all(struct CurveMapping *cumap);
/* call before _all_ evaluation functions */
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h
index c6a6b06..2834a37 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -85,7 +85,7 @@ typedef struct bContextStore {
struct bContextStore *next, *prev;
ListBase entries;
- int used;
+ bool used;
} bContextStore;
/* for the context's rna mode enum
diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h
index bba2093..67c1b68 100644
--- a/source/blender/blenkernel/BKE_text.h
+++ b/source/blender/blenkernel/BKE_text.h
@@ -66,18 +66,18 @@ int txt_utf8_offset_to_index(const char *str, int offset);
int txt_utf8_index_to_offset(const char *str, int index);
int txt_utf8_offset_to_column(const char *str, int offset);
int txt_utf8_column_to_offset(const char *str, int column);
-void txt_move_up (struct Text *text, short sel);
-void txt_move_down (struct Text *text, short sel);
-void txt_move_left (struct Text *text, short sel);
-void txt_move_right (struct Text *text, short sel);
-void txt_jump_left (struct Text *text, bool sel, bool use_init_step);
-void txt_jump_right (struct Text *text, bool sel, bool use_init_step);
-void txt_move_bof (struct Text *text, short sel);
-void txt_move_eof (struct Text *text, short sel);
-void txt_move_bol (struct Text *text, short sel);
-void txt_move_eol (struct Text *text, short sel);
-void txt_move_toline (struct Text *text, unsigned int line, short sel);
-void txt_move_to (struct Text *text, unsigned int line, unsigned int ch, short sel);
+void txt_move_up (struct Text *text, const bool sel);
+void txt_move_down (struct Text *text, const bool sel);
+void txt_move_left (struct Text *text, const bool sel);
+void txt_move_right (struct Text *text, const bool sel);
+void txt_jump_left (struct Text *text, const bool sel, const bool use_init_step);
+void txt_jump_right (struct Text *text, const bool sel, const bool use_init_step);
+void txt_move_bof (struct Text *text, const bool sel);
+void txt_move_eof (struct Text *text, const bool sel);
+void txt_move_bol (struct Text *text, const bool sel);
+void txt_move_eol (struct Text *text, const bool sel);
+void txt_move_toline (struct Text *text, unsigned int line, const bool sel);
+void txt_move_to (struct Text *text, unsigned int line, unsigned int ch, const bool sel);
void txt_pop_sel (struct Text *text);
void txt_delete_char (struct Text *text);
void txt_delete_word (struct Text *text);
diff --git a/source/blender/blenkernel/BKE_unit.h b/source/blender/blenkernel/BKE_unit.h
index 133f3d0..8bccf35 100644
--- a/source/blender/blenkernel/BKE_unit.h
+++ b/source/blender/blenkernel/BKE_unit.h
@@ -34,7 +34,7 @@ extern "C" {
/* in all cases the value is assumed to be scaled by the user preference */
/* humanly readable representation of a value in units (used for button drawing) */
-size_t bUnit_AsString(char *str, int len_max, double value, int prec, int system, int type, int split, int pad);
+size_t bUnit_AsString(char *str, int len_max, double value, int prec, int system, int type, int split, bool pad);
/* replace units with values, used before python button evaluation */
int bUnit_ReplaceString(char *str, int len_max, const char *str_prev, double scale_pref, int system, int type);
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 578fa5d..c2ce779 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -681,7 +681,7 @@ static int sort_curvepoints(const void *a1, const void *a2)
/* ************************ more CurveMapping calls *************** */
/* note; only does current curvemap! */
-void curvemapping_changed(CurveMapping *cumap, int rem_doubles)
+void curvemapping_changed(CurveMapping *cumap, const bool rem_doubles)
{
CurveMap *cuma = cumap->cm + cumap->cur;
CurveMapPoint *cmp = cuma->curve;
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 9660198..b2c10ca 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -847,7 +847,7 @@ int txt_utf8_column_to_offset(const char *str, int column)
return offset;
}
-void txt_move_up(Text *text, short sel)
+void txt_move_up(Text *text, const bool sel)
{
TextLine **linep;
int *charp;
@@ -870,7 +870,7 @@ void txt_move_up(Text *text, short sel)
if (!sel) txt_pop_sel(text);
}
-void txt_move_down(Text *text, short sel)
+void txt_move_down(Text *text, const bool sel)
{
TextLine **linep;
int *charp;
@@ -892,7 +892,7 @@ void txt_move_down(Text *text, short sel)
if (!sel) txt_pop_sel(text);
}
-void txt_move_left(Text *text, short sel)
+void txt_move_left(Text *text, const bool sel)
{
TextLine **linep;
int *charp;
@@ -937,7 +937,7 @@ void txt_move_left(Text *text, short sel)
if (!sel) txt_pop_sel(text);
}
-void txt_move_right(Text *text, short sel)
+void txt_move_right(Text *text, const bool sel)
{
TextLine **linep;
int *charp, do_tab = FALSE, i;
@@ -979,7 +979,7 @@ void txt_move_right(Text *text, short sel)
if (!sel) txt_pop_sel(text);
}
-void txt_jump_left(Text *text, bool sel, bool use_init_step)
+void txt_jump_left(Text *text, const bool sel, const bool use_init_step)
{
TextLine **linep;
int *charp;
@@ -996,7 +996,7 @@ void txt_jump_left(Text *text, bool sel, bool use_init_step)
if (!sel) txt_pop_sel(text);
}
-void txt_jump_right(Text *text, bool sel, bool use_init_step)
+void txt_jump_right(Text *text, const bool sel, const bool use_init_step)
{
TextLine **linep;
int *charp;
@@ -1013,7 +1013,7 @@ void txt_jump_right(Text *text, bool sel, bool use_init_step)
if (!sel) txt_pop_sel(text);
}
-void txt_move_bol(Text *text, short sel)
+void txt_move_bol(Text *text, const bool sel)
{
TextLine **linep;
int *charp;
@@ -1028,7 +1028,7 @@ void txt_move_bol(Text *text, short sel)
if (!sel) txt_pop_sel(text);
}
-void txt_move_eol(Text *text, short sel)
+void txt_move_eol(Text *text, const bool sel)
{
TextLine **linep;
int *charp;
@@ -1043,7 +1043,7 @@ void txt_move_eol(Text *text, short sel)
if (!sel) txt_pop_sel(text);
}
-void txt_move_bof(Text *text, short sel)
+void txt_move_bof(Text *text, const bool sel)
{
TextLine **linep;
int *charp;
@@ -1059,7 +1059,7 @@ void txt_move_bof(Text *text, short sel)
if (!sel) txt_pop_sel(text);
}
-void txt_move_eof(Text *text, short sel)
+void txt_move_eof(Text *text, const bool sel)
{
TextLine **linep;
int *charp;
@@ -1075,13 +1075,13 @@ void txt_move_eof(Text *text, short sel)
if (!sel) txt_pop_sel(text);
}
-void txt_move_toline(Text *text, unsigned int line, short sel)
+void txt_move_toline(Text *text, unsigned int line, const bool sel)
{
txt_move_to(text, line, 0, sel);
}
/* Moves to a certain byte in a line, not a certain utf8-character! */
-void txt_move_to(Text *text, unsigned int line, unsigned int ch, short sel)
+void txt_move_to(Text *text, unsigned int line, unsigned int ch, const bool sel)
{
TextLine **linep;
int *charp;
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index 11a3975..a26b579 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -29,12 +29,14 @@
#include <ctype.h>
#include <string.h>
#include <assert.h>
-#include "BKE_unit.h"
+#include "BLI_sys_types.h"
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_string_utf8.h"
+#include "BKE_unit.h" /* own include */
+
#ifdef WIN32
# include "BLI_winstuff.h"
#endif
@@ -421,7 +423,7 @@ static size_t unit_as_string(char *str, int len_max, double value, int prec, bUn
/* Used for drawing number buttons, try keep fast.
* Return the length of the generated string.
*/
-size_t bUnit_AsString(char *str, int len_max, double value, int prec, int system, int type, int split, int pad)
+size_t bUnit_AsString(char *str, int len_max, double value, int prec, int system, int type, int split, bool pad)
{
bUnitCollection *usys = unit_get_system(system, type);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index cf71e18..af303e8 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -522,30 +522,31 @@ static void ui_draw_links(uiBlock *block)
/* Draw the inactive lines (lines with neither button being hovered over).
* As we go, remember if we see any active or selected lines. */
- int foundselectline = FALSE;
- int foundactiveline = FALSE;
+ bool found_selectline = false;
+ bool found_activeline = false;
+
for (but = block->buttons.first; but; but = but->next) {
if (but->type == LINK && but->link) {
for (line = but->link->lines.first; line; line = line->next) {
if (!(line->from->flag & UI_ACTIVE) && !(line->to->flag & UI_ACTIVE))
ui_draw_linkline(line, 0);
else
- foundactiveline = TRUE;
+ found_activeline = true;
if ((line->from->flag & UI_SELECT) || (line->to->flag & UI_SELECT))
- foundselectline = TRUE;
+ found_selectline = true;
}
}
}
/* Draw any active lines (lines with either button being hovered over).
* Do this last so they appear on top of inactive lines. */
- if (foundactiveline) {
+ if
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list