Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_sequencer/sequencer_channels_edit.c
| /* SPDX-License-Identifier: GPL-2.0-or-later | /* SPDX-License-Identifier: GPL-2.0-or-later | ||||
| * Copyright 2022 Blender Foundation. All rights reserved. */ | * Copyright 2022 Blender Foundation. All rights reserved. */ | ||||
| /** \file | /** \file | ||||
| * \ingroup sequencer | * \ingroup sequencer | ||||
| */ | */ | ||||
| #include "DNA_scene_types.h" | |||||
| #include "DNA_screen_types.h" | #include "DNA_screen_types.h" | ||||
| #include "DNA_video_edit_types.h" | |||||
| #include "DNA_windowmanager_types.h" | #include "DNA_windowmanager_types.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BLI_blenlib.h" | #include "BLI_blenlib.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| Show All 17 Lines | static int sequencer_rename_channel_invoke(bContext *C, | ||||
| const wmEvent *event) | const wmEvent *event) | ||||
| { | { | ||||
| SeqChannelDrawContext context; | SeqChannelDrawContext context; | ||||
| SpaceSeq *sseq = CTX_wm_space_seq(C); | SpaceSeq *sseq = CTX_wm_space_seq(C); | ||||
| channel_draw_context_init(C, CTX_wm_region(C), &context); | channel_draw_context_init(C, CTX_wm_region(C), &context); | ||||
| float mouse_y = UI_view2d_region_to_view_y(context.timeline_region_v2d, event->mval[1]); | float mouse_y = UI_view2d_region_to_view_y(context.timeline_region_v2d, event->mval[1]); | ||||
| sseq->runtime.rename_channel_index = mouse_y; | sseq->runtime.rename_channel_index = mouse_y; | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, CTX_data_scene(C)); | WM_event_add_notifier(C, NC_VIDEO_EDIT | ND_SEQUENCER, CTX_data_video_edit(C)); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| void SEQUENCER_OT_rename_channel(struct wmOperatorType *ot) | void SEQUENCER_OT_rename_channel(struct wmOperatorType *ot) | ||||
| { | { | ||||
| /* Identifiers. */ | /* Identifiers. */ | ||||
| ot->name = "Rename Channel"; | ot->name = "Rename Channel"; | ||||
| ot->idname = "SEQUENCER_OT_rename_channel"; | ot->idname = "SEQUENCER_OT_rename_channel"; | ||||
| /* Api callbacks. */ | /* Api callbacks. */ | ||||
| ot->invoke = sequencer_rename_channel_invoke; | ot->invoke = sequencer_rename_channel_invoke; | ||||
| ot->poll = sequencer_edit_poll; | ot->poll = sequencer_edit_poll; | ||||
| /* Flags. */ | /* Flags. */ | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; | ||||
| } | } | ||||