diff options
author | Hans Goudey <h.goudey@me.com> | 2020-09-17 06:56:29 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-09-17 06:56:29 +0300 |
commit | 7a1c405bb4c10f100e90752f5032de38f8b9c0db (patch) | |
tree | 0483f8c31d680d57fcac49e1b5bebccd53bddbc6 /source/blender/editors/interface/interface_panel.c | |
parent | 971fe43d06ddad94933666c89c40ed345338992a (diff) |
Cleanup: Comment formatting in interface_panel.c
Also cleaned up some grammar and wording issues, and switched a case
in an if statement to remove a double negative.
Diffstat (limited to 'source/blender/editors/interface/interface_panel.c')
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 166 |
1 files changed, 80 insertions, 86 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index aee2529134c..7312c410bba 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -500,7 +500,7 @@ static bool panel_set_expand_from_list_data_recursive(Panel *panel, short flag, /** * Set the expansion of the panel and its sub-panels from the flag stored by the list data - * corresponding to this panel. The flag has expansion stored in each bit in depth first + * corresponding to each panel. The flag has expansion stored in each bit in depth first * order. */ void UI_panel_set_expand_from_list_data(const bContext *C, Panel *panel) @@ -566,7 +566,7 @@ static void set_panels_list_data_expand_flag(const bContext *C, const ARegion *r /* Check for #PNL_ACTIVE so we only set the expand flag for active panels. */ if (panel_type->flag & PNL_INSTANCED && panel->runtime_flag & PNL_ACTIVE) { - short expand_flag = 0; /* Initialize to quite complaining compiler, value not used. */ + short expand_flag; short flag_index = 0; get_panel_expand_flag(panel, &expand_flag, &flag_index); if (panel->type->set_list_data_expand_flag) { @@ -611,7 +611,7 @@ static void panels_collapse_all(ARegion *region, const Panel *from_panel) LISTBASE_FOREACH (Panel *, panel, ®ion->panels) { PanelType *pt = panel->type; - /* close panels with headers in the same context */ + /* Close panels with headers in the same context. */ if (pt && from_pt && !(pt->flag & PNL_NO_HEADER)) { if (!pt->context[0] || !from_pt->context[0] || STREQ(pt->context, from_pt->context)) { if ((panel->flag & PNL_PIN) || !category || !pt->category[0] || @@ -661,11 +661,7 @@ Panel *UI_panel_begin( const char *idname = pt->idname; const bool newpanel = (panel == NULL); - if (!newpanel) { - panel->type = pt; - } - else { - /* new panel */ + if (newpanel) { panel = MEM_callocN(sizeof(Panel), "new panel"); panel->type = pt; BLI_strncpy(panel->panelname, idname, sizeof(panel->panelname)); @@ -684,11 +680,15 @@ Panel *UI_panel_begin( BLI_addtail(lb, panel); } + else { + /* Panel already exists. */ + panel->type = pt; + } /* Do not allow closed panels without headers! Else user could get "disappeared" UI! */ if ((pt->flag & PNL_NO_HEADER) && (panel->flag & PNL_CLOSED)) { panel->flag &= ~PNL_CLOSED; - /* Force update of panels' positions! */ + /* Force update of panels' positions. */ panel->sizex = 0; panel->sizey = 0; panel->blocksizex = 0; @@ -697,9 +697,8 @@ Panel *UI_panel_begin( BLI_strncpy(panel->drawname, drawname, sizeof(panel->drawname)); - /* if a new panel is added, we insert it right after the panel - * that was last added. this way new panels are inserted in the - * right place between versions */ + /* If a new panel is added, we insert it right after the panel that was last added. + * This way new panels are inserted in the right place between versions */ for (panel_last = lb->first; panel_last; panel_last = panel_last->next) { if (panel_last->runtime_flag & PNL_LAST_ADDED) { BLI_remlink(lb, panel); @@ -722,7 +721,7 @@ Panel *UI_panel_begin( panel_last->runtime_flag &= ~PNL_LAST_ADDED; } - /* assign to block */ + /* Assign the new panel to the block. */ block->panel = panel; panel->runtime_flag |= PNL_ACTIVE | PNL_LAST_ADDED; if (region->alignment == RGN_ALIGN_FLOAT) { @@ -777,7 +776,7 @@ void UI_panel_end(const ARegion *region, uiBlock *block, int width, int height, const int old_sizex = panel->sizex, old_sizey = panel->sizey; const int old_region_ofsx = panel->runtime.region_ofsx; - /* update width/height if non-zero */ + /* Update width/height if non-zero. */ if (width != 0) { panel->sizex = width; } @@ -785,7 +784,7 @@ void UI_panel_end(const ARegion *region, uiBlock *block, int width, int height, panel->sizey = height; } - /* check if we need to do an animation */ + /* Check if we need to do an animation. */ if (panel->sizex != old_sizex || panel->sizey != old_sizey) { panel->runtime_flag |= PNL_ANIM_ALIGN; panel->ofsy += old_sizey - panel->sizey; @@ -802,7 +801,7 @@ static void ui_offset_panel_block(uiBlock *block) { const uiStyle *style = UI_style_get_dpi(); - /* compute bounds and offset */ + /* Compute bounds and offset. */ ui_block_bounds_calc(block); const int ofsy = block->panel->sizey - style->panelspace; @@ -898,12 +897,12 @@ void UI_draw_icon_tri(float x, float y, char dir, const float color[4]) else if (dir == 't') { UI_draw_anti_tria(x - f5, y - f7, x + f5, y - f7, x, y + f3, color); } - else { /* 'v' = vertical, down */ + else { /* 'v' = vertical, down. */ UI_draw_anti_tria(x - f5, y + f3, x + f5, y + f3, x, y - f7, color); } } -#define PNL_ICON UI_UNIT_X /* could be UI_UNIT_Y too */ +#define PNL_ICON UI_UNIT_X /* Could be UI_UNIT_Y too. */ /* For button layout next to label. */ void UI_panel_label_offset(uiBlock *block, int *r_x, int *r_y) @@ -929,10 +928,10 @@ static void ui_draw_aligned_panel_header(const uiStyle *style, const bool is_subpanel = (panel->type && panel->type->parent); const uiFontStyle *fontstyle = (is_subpanel) ? &style->widgetlabel : &style->paneltitle; - /* + 0.001f to avoid flirting with float inaccuracy */ + /* + 0.001f to avoid flirting with float inaccuracy .*/ const int pnl_icons = (panel->labelofs + (1.1f * PNL_ICON)) / block->aspect + 0.001f; - /* draw text label */ + /* Draw text label.s */ uchar col_title[4]; panel_title_color_get( panel, show_background, is_subpanel, region_search_filter_active, col_title); @@ -951,7 +950,7 @@ static void ui_draw_aligned_panel_header(const uiStyle *style, } /** - * Panel integrated in buttons-window, tool/property lists etc + * Draw a panel integrated in buttons-window, tool/property lists etc */ void ui_draw_aligned_panel(const uiStyle *style, const uiBlock *block, @@ -1032,7 +1031,7 @@ void ui_draw_aligned_panel(const uiStyle *style, immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); GPU_blend(GPU_BLEND_ALPHA); - /* draw with background color */ + /* Draw with background color. */ immUniformThemeColor(UI_panel_matches_search_filter(panel) ? TH_MATCH : TH_PANEL_HEADER); immRectf(pos, minx, headrect.ymin, rect->xmax, y); @@ -1067,7 +1066,7 @@ void ui_draw_aligned_panel(const uiStyle *style, GPU_blend(GPU_BLEND_NONE); } - /* horizontal title */ + /* Draw the title. */ rcti titlerect = headrect; if (is_subpanel) { titlerect.xmin += (0.7f * UI_UNIT_X) / block->aspect + 0.001f; @@ -1159,7 +1158,7 @@ void ui_draw_aligned_panel(const uiStyle *style, immUnbindProgram(); } - /* draw collapse icon */ + /* Draw collapse icon. */ { rctf itemrect = {.xmin = titlerect.xmin, .xmax = itemrect.xmin + BLI_rcti_size_y(&titlerect), @@ -1196,7 +1195,7 @@ static void imm_buf_append( (*index)++; } -/* based on UI_draw_roundbox, check on making a version which allows us to skip some sides */ +/* Based on UI_draw_roundbox, check on making a version which allows us to skip some sides. */ static void ui_panel_category_draw_tab(bool filled, float minx, float miny, @@ -1212,7 +1211,6 @@ static void ui_panel_category_draw_tab(bool filled, { float vec[4][2] = {{0.195, 0.02}, {0.55, 0.169}, {0.831, 0.45}, {0.98, 0.805}}; - /* Multiply `vec` by radius. */ for (int a = 0; a < 4; a++) { mul_v2_fl(vec[a], rad); } @@ -1234,7 +1232,7 @@ static void ui_panel_category_draw_tab(bool filled, uchar cbuf[24][3]; int buf_index = 0; - /* start with corner right-top */ + /* Start right-top corner. */ if (use_highlight) { if (roundboxtype & UI_CNR_TOP_RIGHT) { imm_buf_append(vbuf, cbuf, maxx, maxy - rad, col, &buf_index); @@ -1247,7 +1245,7 @@ static void ui_panel_category_draw_tab(bool filled, imm_buf_append(vbuf, cbuf, maxx, maxy, col, &buf_index); } - /* corner left-top */ + /* Left top-corner. */ if (roundboxtype & UI_CNR_TOP_LEFT) { imm_buf_append(vbuf, cbuf, minx + rad, maxy, col, &buf_index); for (int a = 0; a < 4; a++) { @@ -1265,7 +1263,7 @@ static void ui_panel_category_draw_tab(bool filled, vbuf, cbuf, minx, miny + rad, highlight_fade ? col : highlight_fade, &buf_index); } else { - /* corner left-bottom */ + /* Left bottom-corner. */ if (roundboxtype & UI_CNR_BOTTOM_LEFT) { imm_buf_append(vbuf, cbuf, minx, miny + rad, col, &buf_index); for (int a = 0; a < 4; a++) { @@ -1277,7 +1275,7 @@ static void ui_panel_category_draw_tab(bool filled, imm_buf_append(vbuf, cbuf, minx, miny, col, &buf_index); } - /* corner right-bottom */ + /* Right-bottom corner. */ if (roundboxtype & UI_CNR_BOTTOM_RIGHT) { imm_buf_append(vbuf, cbuf, maxx - rad, miny, col, &buf_index); for (int a = 0; a < 4; a++) { @@ -1313,12 +1311,10 @@ static void ui_panel_category_draw_tab(bool filled, } /** - * Draw vertical tabs on the left side of the region, - * one tab per category. + * Draw vertical tabs on the left side of the region, one tab per category. */ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) { - /* no tab outlines for */ // #define USE_FLAT_INACTIVE const bool is_left = RGN_ALIGN_ENUM_FROM_MASK(region->alignment != RGN_ALIGN_RIGHT); View2D *v2d = ®ion->v2d; @@ -1332,9 +1328,9 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) const int px_x_sign = is_left ? px : -px; const int category_tabs_width = round_fl_to_int(UI_PANEL_CATEGORY_MARGIN_WIDTH * zoom); const float dpi_fac = UI_DPI_FAC; - /* padding of tabs around text */ + /* Padding of tabs around text. */ const int tab_v_pad_text = round_fl_to_int((2 + ((px * 3) * dpi_fac)) * zoom); - /* padding between tabs */ + /* Padding between tabs. */ const int tab_v_pad = round_fl_to_int((4 + (2 * px * dpi_fac)) * zoom); const float tab_curve_radius = ((px * 3) * dpi_fac) * zoom; /* We flip the tab drawing, so always use these flags. */ @@ -1345,27 +1341,27 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) bool is_active_prev = false; #endif float scaletabs = 1.0f; - /* same for all tabs */ - /* intentionally don't scale by 'px' */ + /* Same for all tabs. */ + /* Intentionally don't scale by 'px'. */ const int rct_xmin = is_left ? v2d->mask.xmin + 3 : (v2d->mask.xmax - category_tabs_width); const int rct_xmax = is_left ? v2d->mask.xmin + category_tabs_width : (v2d->mask.xmax - 3); const int text_v_ofs = (rct_xmax - rct_xmin) * 0.3f; int y_ofs = tab_v_pad; - /* Primary theme colors */ + /* Primary theme colors. */ uchar theme_col_back[4]; uchar theme_col_text[3]; uchar theme_col_text_hi[3]; - /* Tab colors */ + /* Tab colors. */ uchar theme_col_tab_bg[4]; uchar theme_col_tab_active[3]; uchar theme_col_tab_inactive[3]; - /* Secondary theme colors */ + /* Secondary theme colors. */ uchar theme_col_tab_outline[3]; - uchar theme_col_tab_divider[3]; /* line that divides tabs from the main region */ + uchar theme_col_tab_divider[3]; /* Line that divides tabs from the main region. */ uchar theme_col_tab_highlight[3]; uchar theme_col_tab_highlight_inactive[3]; @@ -1430,14 +1426,14 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) do_scaletabs = true; } - /* begin drawing */ + /* Begin drawing. */ GPU_line_smooth(true); uint pos = GPU_vertformat_attr_add( immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - /* draw the background */ + /* Draw the background. */ if (is_alpha) { GPU_blend(GPU_BLEND_ALPHA); immUniformColor4ubv(theme_col_tab_bg); @@ -1498,7 +1494,7 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) NULL, is_active ? theme_col_tab_active : theme_col_tab_inactive); - /* Tab outline */ + /* Tab outline. */ ui_panel_category_draw_tab(false, rct->xmin - px_x_sign, rct->ymin - px, @@ -1512,7 +1508,7 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) NULL, theme_col_tab_outline); - /* Tab highlight (3d look) */ + /* Tab highlight (3d look). */ ui_panel_category_draw_tab(false, rct->xmin, rct->ymin, @@ -1584,7 +1580,7 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) #endif immUnbindProgram(); - /* not essential, but allows events to be handled right up until the region edge [#38171] */ + /* Not essential, but allows events to be handled right up to the region edge (T38171). */ if (is_left) { pc_dyn->rect.xmin = v2d->mask.xmin; } @@ -1729,11 +1725,12 @@ static void align_sub_panels(Panel *panel) } } -/* this doesn't draw */ -/* returns 1 when it did something */ +/** + * Calculate the position and order of panels as they are opened, closed, and dragged. + */ static bool uiAlignPanelStep(ARegion *region, const float fac, const bool drag) { - /* count active, not tabbed panels */ + /* Count active panels. */ int tot = 0; LISTBASE_FOREACH (Panel *, panel, ®ion->panels) { if (panel->runtime_flag & PNL_ACTIVE) { @@ -1745,7 +1742,7 @@ static bool uiAlignPanelStep(ARegion *region, const float fac, const bool drag) return 0; } - /* sort panels */ + /* Sort panels. */ PanelSort *panelsort = MEM_callocN(tot * sizeof(PanelSort), "panelsort"); PanelSort *ps = panelsort; @@ -1797,7 +1794,7 @@ static bool uiAlignPanelStep(ARegion *region, const float fac, const bool drag) panelsort[tot - 1].panel->ofsx += UI_PANEL_BOX_STYLE_MARGIN; } - /* we interpolate */ + /* We interpolate. */ bool changed = false; ps = panelsort; for (int i = 0; i < tot; i++, ps++) { @@ -1812,7 +1809,7 @@ static bool uiAlignPanelStep(ARegion *region, const float fac, const bool drag) } } - /* set locations for tabbed and sub panels */ + /* Set locations for tabbed and sub panels. */ LISTBASE_FOREACH (Panel *, panel, ®ion->panels) { if (panel->runtime_flag & PNL_ACTIVE) { if (panel->children.first) { @@ -1836,7 +1833,7 @@ static void ui_panels_size(ARegion *region, int *r_x, int *r_y) int sizex = 0; int sizey = 0; - /* compute size taken up by panels, for setting in view2d */ + /* Compute size taken up by panels, for setting in view2d. */ LISTBASE_FOREACH (Panel *, panel, ®ion->panels) { if (panel->runtime_flag & PNL_ACTIVE) { const int pa_sizex = panel->ofsx + panel->sizex; @@ -1866,7 +1863,7 @@ static void ui_do_animate(bContext *C, Panel *panel) float fac = (PIL_check_seconds_timer() - data->starttime) / ANIMATION_TIME; fac = min_ff(sqrtf(fac), 1.0f); - /* for max 1 second, interpolate positions */ + /* For max 1 second, interpolate positions. */ if (uiAlignPanelStep(region, fac, false)) { ED_region_tag_redraw(region); } @@ -1890,8 +1887,6 @@ static void ui_do_animate(bContext *C, Panel *panel) static void panel_list_clear_active(ListBase *lb) { - /* set all panels as inactive, so that at the end we know - * which ones were used */ LISTBASE_FOREACH (Panel *, panel, lb) { if (panel->runtime_flag & PNL_ACTIVE) { panel->runtime_flag = PNL_WAS_ACTIVE; @@ -1906,10 +1901,10 @@ static void panel_list_clear_active(ListBase *lb) void UI_panels_begin(const bContext *UNUSED(C), ARegion *region) { + /* Set all panels as inactive, so that at the end we know which ones were used. */ panel_list_clear_active(®ion->panels); } -/* only draws blocks with panels */ void UI_panels_end(const bContext *C, ARegion *region, int *r_x, int *r_y) { ScrArea *area = CTX_wm_area(C); @@ -1925,14 +1920,14 @@ void UI_panels_end(const bContext *C, ARegion *region, int *r_x, int *r_y) } } - /* offset contents */ + /* Offset contents */ LISTBASE_FOREACH (uiBlock *, block, ®ion->uiblocks) { if (block->active && block->panel) { ui_offset_panel_block(block); } } - /* re-align, possibly with animation */ + /* Re-align, possibly with animation. */ Panel *panel; if (panels_need_realign(area, region, &panel)) { if (panel) { @@ -1943,7 +1938,7 @@ void UI_panels_end(const bContext *C, ARegion *region, int *r_x, int *r_y) } } - /* tag first panel */ + /* Tag first panel. */ Panel *panel_first = NULL; LISTBASE_FOREACH (uiBlock *, block, ®ion->uiblocks) { if (block->active && block->panel) { @@ -1957,7 +1952,7 @@ void UI_panels_end(const bContext *C, ARegion *region, int *r_x, int *r_y) panel_first->runtime_flag |= PNL_FIRST; } - /* compute size taken up by panel */ + /* Compute size taken up by panel. */ ui_panels_size(region, r_x, r_y); } @@ -2032,7 +2027,7 @@ static void ui_do_drag(const bContext *C, const wmEvent *event, Panel *panel) panel->ofsy = data->startofsy + dy; } else { - /* reset the panel snapping, to allow dragging away from snapped edges */ + /* Reset the panel snapping, to allow dragging away from snapped edges. */ panel->snap = PNL_SNAP_NONE; /* Add the movement of the view due to edge scrolling while dragging. */ @@ -2103,10 +2098,10 @@ static void ui_panel_drag_collapse(const bContext *C, } const int oldflag = panel->flag; - /* lock axis */ + /* Lock axis. */ xy_b_block[0] = dragcol_data->xy_init[0]; - /* use cursor coords in block space */ + /* Use cursor coords in block space. */ ui_window_to_block_fl(region, block, &xy_a_block[0], &xy_a_block[1]); ui_window_to_block_fl(region, block, &xy_b_block[0], &xy_b_block[1]); @@ -2115,12 +2110,12 @@ static void ui_panel_drag_collapse(const bContext *C, rect.ymin = rect.ymax; rect.ymax = rect.ymin + PNL_HEADER; - /* touch all panels between last mouse coord and the current one */ + /* Touch all panels between last mouse coordinate and the current one. */ if (BLI_rctf_isect_segment(&rect, xy_a_block, xy_b_block)) { /* Force panel to open or close. */ SET_FLAG_FROM_TEST(panel->flag, dragcol_data->was_first_open, PNL_CLOSED); - /* if panel->flag has changed this means a panel was opened/closed here */ + /* If panel->flag has changed this means a panel was opened/closed here. */ if (panel->flag != oldflag) { panel_activate_state(C, panel, PANEL_STATE_ANIMATION); } @@ -2131,9 +2126,10 @@ static void ui_panel_drag_collapse(const bContext *C, } /** - * Panel drag-collapse (modal handler) - * Clicking and dragging over panels toggles their collapse state based on the panel that was first - * dragged over. If it was open all affected panels incl the initial one are closed and vice versa. + * Panel drag-collapse (modal handler). + * Clicking and dragging over panels toggles their collapse state based on the panel + * that was first dragged over. If it was open all affected panels including the initial + * one are closed and vice versa. */ static int ui_panel_drag_collapse_handler(bContext *C, const wmEvent *event, void *userdata) { @@ -2149,7 +2145,7 @@ static int ui_panel_drag_collapse_handler(bContext *C, const wmEvent *event, voi break; case LEFTMOUSE: if (event->val == KM_RELEASE) { - /* done! */ + /* Done! */ WM_event_remove_ui_handler(&win->modalhandlers, ui_panel_drag_collapse_handler, ui_panel_drag_collapse_handler_remove, @@ -2157,7 +2153,7 @@ static int ui_panel_drag_collapse_handler(bContext *C, const wmEvent *event, voi true); ui_panel_drag_collapse_handler_remove(C, dragcol_data); } - /* don't let any left-mouse event fall through! */ + /* Don't let any left-mouse event fall through! */ retval = WM_UI_HANDLER_BREAK; break; } @@ -2293,7 +2289,7 @@ static void ui_handle_panel_header(const bContext *C, bool UI_panel_category_is_visible(const ARegion *region) { - /* more than one */ + /* Check for more than one category. */ return region->panels_category.first && region->panels_category.first != region->panels_category.last; } @@ -2330,9 +2326,9 @@ static void ui_panel_category_active_set(ARegion *region, const char *idname, bo BLI_addhead(lb, pc_act); } - /* Validate all active panels, we could do this on load, - * they are harmless - but we should remove somewhere. - * (add-ons could define own and gather cruft over time). */ + /* Validate all active panels. We could do this on load, they are harmless - + * but we should remove them somewhere. + * (Add-ons could define panels and gather cruft over time). */ { PanelCategoryStack *pc_act_next; /* intentionally skip first */ @@ -2402,7 +2398,7 @@ void UI_panel_category_add(ARegion *region, const char *name) BLI_strncpy(pc_dyn->idname, name, sizeof(pc_dyn->idname)); - /* 'pc_dyn->rect' must be set on draw */ + /* 'pc_dyn->rect' must be set on draw. */ } void UI_panel_category_clear_all(ARegion *region) @@ -2420,14 +2416,13 @@ static int ui_handle_panel_category_cycling(const wmEvent *event, (event->mval[0] < ((PanelCategoryDyn *)region->panels_category.first)->rect.xmax) : (event->mval[0] > ((PanelCategoryDyn *)region->panels_category.first)->rect.xmin)); - /* if mouse is inside non-tab region, ctrl key is required */ + /* If mouse is inside non-tab region, ctrl key is required. */ if (is_mousewheel && !event->ctrl && !inside_tabregion) { return WM_UI_HANDLER_CONTINUE; } if (active_but && ui_but_supports_cycling(active_but)) { - /* skip - exception to make cycling buttons - * using ctrl+mousewheel work in tabbed regions */ + /* Skip - exception to make cycling buttons using ctrl+mousewheel work in tabbed regions. */ } else { const char *category = UI_panel_category_active_get(region, false); @@ -2435,22 +2430,21 @@ static int ui_handle_panel_category_cycling(const wmEvent *event, PanelCategoryDyn *pc_dyn = UI_panel_category_find(region, category); if (LIKELY(pc_dyn)) { if (is_mousewheel) { - /* we can probably get rid of this and only allow ctrl+tabbing */ + /* We can probably get rid of this and only allow ctrl-tabbing. */ pc_dyn = (event->type == WHEELDOWNMOUSE) ? pc_dyn->next : pc_dyn->prev; } else { const bool backwards = event->shift; pc_dyn = backwards ? pc_dyn->prev : pc_dyn->next; if (!pc_dyn) { - /* proper cyclic behavior, - * back to first/last category (only used for ctrl+tab) */ + /* Proper cyclic behavior, back to first/last category (only used for ctrl+tab). */ pc_dyn = backwards ? region->panels_category.last : region->panels_category.first; } } if (pc_dyn) { - /* intentionally don't reset scroll in this case, - * this allows for quick browsing between tabs */ + /* Intentionally don't reset scroll in this case, + * allowing for quick browsing between tabs. */ UI_panel_category_active_set(region, pc_dyn->idname); ED_region_tag_redraw(region); } @@ -2629,13 +2623,13 @@ PointerRNA *UI_region_panel_custom_data_under_cursor(const bContext *C, const wm /** \name Window Level Modal Panel Interaction * \{ */ -/* note, this is modal handler and should not swallow events for animation */ +/* Note, this is modal handler and should not swallow events for animation. */ static int ui_handler_panel(bContext *C, const wmEvent *event, void *userdata) { Panel *panel = userdata; uiHandlePanelData *data = panel->activedata; - /* verify if we can stop */ + /* Verify if we can stop. */ if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { panel_activate_state(C, panel, PANEL_STATE_ANIMATION); } |