[Bf-blender-cvs] [63ee378fa96] master: Cleanup: move comments above definitions, use enum

Campbell Barton noreply at git.blender.org
Mon Jan 14 05:59:40 CET 2019


Commit: 63ee378fa96d1906adc8da3d318a73333f52b643
Author: Campbell Barton
Date:   Mon Jan 14 15:58:40 2019 +1100
Branches: master
https://developer.blender.org/rB63ee378fa96d1906adc8da3d318a73333f52b643

Cleanup: move comments above definitions, use enum

For clang-format not to wrap definitions.

===================================================================

M	source/blender/editors/include/UI_interface.h

===================================================================

diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index d4d2adadbac..821f683cf6e 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -109,14 +109,14 @@ enum {
 
 /* uiBlock->direction */
 enum {
-	UI_DIR_UP           = (1 << 0),
-	UI_DIR_DOWN         = (1 << 1),
-	UI_DIR_LEFT         = (1 << 2),
-	UI_DIR_RIGHT        = (1 << 3),
-	UI_DIR_CENTER_X     = (1 << 4),
-	UI_DIR_CENTER_Y     = (1 << 5),
-
-	UI_DIR_ALL          = (UI_DIR_UP | UI_DIR_DOWN | UI_DIR_LEFT | UI_DIR_RIGHT),
+	UI_DIR_UP           = 1 << 0,
+	UI_DIR_DOWN         = 1 << 1,
+	UI_DIR_LEFT         = 1 << 2,
+	UI_DIR_RIGHT        = 1 << 3,
+	UI_DIR_CENTER_X     = 1 << 4,
+	UI_DIR_CENTER_Y     = 1 << 5,
+
+	UI_DIR_ALL          = UI_DIR_UP | UI_DIR_DOWN | UI_DIR_LEFT | UI_DIR_RIGHT,
 };
 
 #if 0
@@ -125,77 +125,102 @@ enum {
 #define UI_BLOCK_ROWS      2
 #endif
 
-/* uiBlock->flag (controls) */
-#define UI_BLOCK_LOOP           (1 << 0)
-#define UI_BLOCK_IS_FLIP        (1 << 1)
-#define UI_BLOCK_NO_FLIP        (1 << 2)
-#define UI_BLOCK_NUMSELECT      (1 << 3)
-#define UI_BLOCK_NO_WIN_CLIP    (1 << 4)   /* don't apply window clipping */ /* was UI_BLOCK_ENTER_OK */
-#define UI_BLOCK_CLIPBOTTOM     (1 << 5)
-#define UI_BLOCK_CLIPTOP        (1 << 6)
-#define UI_BLOCK_MOVEMOUSE_QUIT (1 << 7)
-#define UI_BLOCK_KEEP_OPEN      (1 << 8)
-#define UI_BLOCK_POPUP          (1 << 9)
-#define UI_BLOCK_OUT_1          (1 << 10)
-#define UI_BLOCK_SEARCH_MENU    (1 << 11)
-#define UI_BLOCK_POPUP_MEMORY   (1 << 12)
-#define UI_BLOCK_CLIP_EVENTS    (1 << 13)  /* stop handling mouse events */
-
-/* block->flag bits 14-17 are identical to but->drawflag bits */
-
-#define UI_BLOCK_POPUP_HOLD  (1 << 18)
-#define UI_BLOCK_LIST_ITEM   (1 << 19)
-#define UI_BLOCK_RADIAL      (1 << 20)
-#define UI_BLOCK_POPOVER     (1 << 21)
-#define UI_BLOCK_POPOVER_ONCE (1 << 22)
-/** Always show keymaps, even for non-menus. */
-#define UI_BLOCK_SHOW_SHORTCUT_ALWAYS (1 << 23)
-
-/* uiPopupBlockHandle->menuretval */
-#define UI_RETURN_CANCEL     (1 << 0)   /* cancel all menus cascading */
-#define UI_RETURN_OK         (1 << 1)   /* choice made */
-#define UI_RETURN_OUT        (1 << 2)   /* left the menu */
-#define UI_RETURN_OUT_PARENT (1 << 3)   /* let the parent handle this event */
-#define UI_RETURN_UPDATE     (1 << 4)   /* update the button that opened */
-#define UI_RETURN_POPUP_OK   (1 << 5)   /* popup is ok to be handled */
+/** #uiBlock.flag (controls) */
+enum {
+	UI_BLOCK_LOOP =           1 << 0,
+	UI_BLOCK_IS_FLIP =        1 << 1,
+	UI_BLOCK_NO_FLIP =        1 << 2,
+	UI_BLOCK_NUMSELECT =      1 << 3,
+	/** Don't apply window clipping. */
+	UI_BLOCK_NO_WIN_CLIP =    1 << 4,
+	UI_BLOCK_CLIPBOTTOM =     1 << 5,
+	UI_BLOCK_CLIPTOP =        1 << 6,
+	UI_BLOCK_MOVEMOUSE_QUIT = 1 << 7,
+	UI_BLOCK_KEEP_OPEN =      1 << 8,
+	UI_BLOCK_POPUP =          1 << 9,
+	UI_BLOCK_OUT_1 =          1 << 10,
+	UI_BLOCK_SEARCH_MENU =    1 << 11,
+	UI_BLOCK_POPUP_MEMORY =   1 << 12,
+	/* Stop handling mouse events. */
+	UI_BLOCK_CLIP_EVENTS =    1 << 13,
+
+	/* block->flag bits 14-17 are identical to but->drawflag bits */
+
+	UI_BLOCK_POPUP_HOLD =  1 << 18,
+	UI_BLOCK_LIST_ITEM =   1 << 19,
+	UI_BLOCK_RADIAL =      1 << 20,
+	UI_BLOCK_POPOVER =     1 << 21,
+	UI_BLOCK_POPOVER_ONCE = 1 << 22,
+	/** Always show keymaps, even for non-menus. */
+	UI_BLOCK_SHOW_SHORTCUT_ALWAYS = 1 << 23,
+};
+
+/** #uiPopupBlockHandle.menuretval */
+enum {
+	/** Cancel all menus cascading. */
+	UI_RETURN_CANCEL =     1 << 0,
+	/** Choice made. */
+	UI_RETURN_OK =         1 << 1,
+	/** Left the menu. */
+	UI_RETURN_OUT =        1 << 2,
+	/** Let the parent handle this event. */
+	UI_RETURN_OUT_PARENT = 1 << 3,
+	/** Update the button that opened. */
+	UI_RETURN_UPDATE =     1 << 4,
+	/** Popup is ok to be handled. */
+	UI_RETURN_POPUP_OK =   1 << 5,
+};
 
 /* panel controls */
-#define UI_PNL_SOLID    (1 << 1)
-#define UI_PNL_CLOSE    (1 << 5)
-#define UI_PNL_SCALE    (1 << 9)
+enum {
+	UI_PNL_SOLID =    1 << 1,
+	UI_PNL_CLOSE =    1 << 5,
+	UI_PNL_SCALE =    1 << 9,
+};
 
 /* but->flag - general state flags. */
 enum {
-	/* warning, the first 6 flags are internal */
-	UI_BUT_ICON_SUBMENU    = (1 << 6),
-	UI_BUT_ICON_PREVIEW    = (1 << 7),
-
-	UI_BUT_NODE_LINK       = (1 << 8),
-	UI_BUT_NODE_ACTIVE     = (1 << 9),
-	UI_BUT_DRAG_LOCK       = (1 << 10),
-	UI_BUT_DISABLED        = (1 << 11),  /* grayed out and uneditable */
-	UI_BUT_COLOR_LOCK      = (1 << 12),
-	UI_BUT_ANIMATED        = (1 << 13),
-	UI_BUT_ANIMATED_KEY    = (1 << 14),
-	UI_BUT_DRIVEN          = (1 << 15),
-	UI_BUT_REDALERT        = (1 << 16),
-	UI_BUT_INACTIVE        = (1 << 17),  /* grayed out but still editable */
-	UI_BUT_LAST_ACTIVE     = (1 << 18),
-	UI_BUT_UNDO            = (1 << 19),
-	UI_BUT_IMMEDIATE       = (1 << 20),
-	UI_BUT_NO_UTF8         = (1 << 21),
-
-	UI_BUT_VEC_SIZE_LOCK   = (1 << 22),  /* used to flag if color hsv-circle should keep luminance */
-	UI_BUT_COLOR_CUBIC     = (1 << 23),  /* cubic saturation for the color wheel */
-	UI_BUT_LIST_ITEM       = (1 << 24),  /* This but is "inside" a list item (currently used to change theme colors). */
-	UI_BUT_DRAG_MULTI      = (1 << 25),  /* edit this button as well as the active button (not just dragging) */
-
-	UI_BUT_HAS_SEP_CHAR    = (1 << 27),  /* but->str contains UI_SEP_CHAR, used for key shortcuts */
-	UI_BUT_UPDATE_DELAY    = (1 << 28),  /* don't run updates while dragging (needed in rare cases). */
-	UI_BUT_TEXTEDIT_UPDATE = (1 << 29),  /* when widget is in textedit mode, update value on each char stroke */
-	UI_BUT_VALUE_CLEAR     = (1 << 30),  /* show 'x' icon to clear/unlink value of text or search button */
-
-	UI_BUT_OVERRIDEN       = (1u << 31u),  /* RNA property of the button is overridden from linked reference data. */
+	/** warning, the first 6 flags are internal. */
+	UI_BUT_ICON_SUBMENU    = 1 << 6,
+	UI_BUT_ICON_PREVIEW    = 1 << 7,
+
+	UI_BUT_NODE_LINK       = 1 << 8,
+	UI_BUT_NODE_ACTIVE     = 1 << 9,
+	UI_BUT_DRAG_LOCK       = 1 << 10,
+	/** grayed out and uneditable */
+	UI_BUT_DISABLED        = 1 << 11,
+	UI_BUT_COLOR_LOCK      = 1 << 12,
+	UI_BUT_ANIMATED        = 1 << 13,
+	UI_BUT_ANIMATED_KEY    = 1 << 14,
+	UI_BUT_DRIVEN          = 1 << 15,
+	UI_BUT_REDALERT        = 1 << 16,
+	/** grayed out but still editable */
+	UI_BUT_INACTIVE        = 1 << 17,
+	UI_BUT_LAST_ACTIVE     = 1 << 18,
+	UI_BUT_UNDO            = 1 << 19,
+	UI_BUT_IMMEDIATE       = 1 << 20,
+	UI_BUT_NO_UTF8         = 1 << 21,
+
+	/** used to flag if color hsv-circle should keep luminance */
+	UI_BUT_VEC_SIZE_LOCK   = 1 << 22,
+	/** cubic saturation for the color wheel */
+	UI_BUT_COLOR_CUBIC     = 1 << 23,
+	/** This but is "inside" a list item (currently used to change theme colors). */
+	UI_BUT_LIST_ITEM       = 1 << 24,
+	/** edit this button as well as the active button (not just dragging) */
+	UI_BUT_DRAG_MULTI      = 1 << 25,
+
+	/** #uiBut.str contains #UI_SEP_CHAR, used for key shortcuts */
+	UI_BUT_HAS_SEP_CHAR    = 1 << 27,
+	/** Don't run updates while dragging (needed in rare cases). */
+	UI_BUT_UPDATE_DELAY    = 1 << 28,
+	/** When widget is in textedit mode, update value on each char stroke */
+	UI_BUT_TEXTEDIT_UPDATE = 1 << 29,
+	/** Show 'x' icon to clear/unlink value of text or search button. */
+	UI_BUT_VALUE_CLEAR     = 1 << 30,
+
+	/** RNA property of the button is overridden from linked reference data. */
+	UI_BUT_OVERRIDEN       = 1u << 31u,
 };
 
 #define UI_PANEL_WIDTH          340
@@ -209,39 +234,48 @@ enum {
  *       (except for the 'align' ones)!
  */
 enum {
-	/* Text and icon alignment (by default, they are centered). */
-	UI_BUT_TEXT_LEFT         = (1 << 1),
-	UI_BUT_ICON_LEFT         = (1 << 2),
-	UI_BUT_TEXT_RIGHT        = (1 << 3),
-	/* Prevent the button to show any tooltip. */
-	UI_BUT_NO_TOOLTIP        = (1 << 4),
+	/** Text and icon alignment (by default, they are centered). */
+	UI_BUT_TEXT_LEFT         = 1 << 1,
+	UI_BUT_ICON_LEFT         = 1 << 2,
+	UI_BUT_TEXT_RIGHT        = 1 << 3,
+	/** Prevent the button to show any tooltip. */
+	UI_BUT_NO_TOOLTIP        = 1 << 4,
 
 	/* Button align flag, for drawing groups together.
 	 * Used in 'uiBlock.flag', take care! */
-	UI_BUT_ALIGN_TOP         = (1 << 14),
-	UI_BUT_ALIGN_LEFT        = (1 << 15),
-	UI_BUT_ALIGN_RIGHT       = (1 << 16),
-	UI_BUT_ALIGN_DOWN        = (1 << 17),
-	UI_BUT_ALIGN             = (UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_RIGHT | UI_BUT_ALIGN_DOWN),
+	UI_BUT_ALIGN_TOP         = 1 << 14,
+	UI_BUT_ALIGN_LEFT        = 1 << 15,
+	UI_BUT_ALIGN_RIGHT       = 1 << 16,
+	UI_BUT_ALIGN_DOWN        = 1 << 17,
+	UI_BUT_ALIGN             = UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_RIGHT | UI_BUT_ALIGN_DOWN,
 	/* end bits shared with 'uiBlock.flag' */
 
-	/* Warning - HACK! Needed for buttons which are not TOP/LEFT aligned, but have some top/left corner stitched to some
-	 *                 other TOP/LEFT-aligned button, because of 'corrective' hack in widget_roundbox_set()... */
-	UI_BUT_ALIGN_STITCH_TOP  = (1 << 18),
-	UI_BUT_ALIGN_STITCH_LEFT = (1 << 19),
-	UI_BUT_ALIGN_ALL         = (UI_BUT_ALIGN | UI_BUT_ALIGN_STITCH_TOP | UI_BUT_ALIGN_STITCH_LEFT),
+	/**
+	 * Warning - HACK!
+	 * Needed for buttons which are not TOP/LEFT aligned,
+	 * but have some top/left corner stitched to some other TOP/LEFT-aligned button,
+	 * because of 'corrective' hack in widget_roundbox_set()... */
+	UI_BUT_ALIGN_STITCH_TOP  = 1 << 18,
+	UI_BUT_ALIGN_STITCH_LEFT = 1 << 19,
+	UI_BUT_ALIGN_ALL         = UI_BUT_ALIGN | UI_BUT_ALIGN_STITCH_TOP | UI_BUT_ALIGN_STITCH_LEFT,
 
-	UI_BUT_BOX_ITEM          = (1 << 20), /* This but is "inside" a box item (currently used to change theme colors). */
+	/** This but is "inside" a box item (currently used to change theme colors). */
+	UI_BUT_BOX_ITEM          = 1 << 20,
 
-	UI_BUT_ACTIVE_LEFT       = (1 << 21), /* Active left part of number button */
-	UI_BUT_ACTIVE_RIGHT      = (1 << 22), /* Active right part of number button */
+	/** Active left part of number button */
+	UI_BUT_ACTIVE_LEFT       = 1 << 21,
+	/** Active right part of number button */
+	UI_BUT_ACTIVE_RIGHT      = 1 << 22,
 


@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list