Blender
V3.3
source
blender
editors
space_text
text_header.c
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-or-later
2
* Copyright 2008 Blender Foundation. All rights reserved. */
3
8
#include "
DNA_windowmanager_types.h
"
9
10
#include "
MEM_guardedalloc.h
"
11
12
#include "
BLI_blenlib.h
"
13
14
#include "
BKE_context.h
"
15
#include "
BKE_screen.h
"
16
17
#include "
ED_screen.h
"
18
19
#include "
WM_types.h
"
20
21
#include "
UI_interface.h
"
22
23
#include "
text_intern.h
"
24
25
/* ************************ header area region *********************** */
26
27
/************************** properties ******************************/
28
29
static
ARegion
*
text_has_properties_region
(
ScrArea
*
area
)
30
{
31
ARegion
*region, *arnew;
32
33
region =
BKE_area_find_region_type
(
area
,
RGN_TYPE_UI
);
34
if
(region) {
35
return
region;
36
}
37
38
/* add subdiv level; after header */
39
region =
BKE_area_find_region_type
(
area
,
RGN_TYPE_HEADER
);
40
41
/* is error! */
42
if
(region ==
NULL
) {
43
return
NULL
;
44
}
45
46
arnew =
MEM_callocN
(
sizeof
(
ARegion
),
"properties region"
);
47
48
BLI_insertlinkafter
(&
area
->regionbase, region, arnew);
49
arnew->
regiontype
=
RGN_TYPE_UI
;
50
arnew->
alignment
=
RGN_ALIGN_LEFT
;
51
52
arnew->
flag
=
RGN_FLAG_HIDDEN
;
53
54
return
arnew;
55
}
56
57
static
bool
text_properties_poll
(
bContext
*
C
)
58
{
59
return
(
CTX_wm_space_text
(
C
) !=
NULL
);
60
}
61
62
static
int
text_text_search_exec
(
bContext
*
C
,
wmOperator
*
UNUSED
(op))
63
{
64
ScrArea
*
area
=
CTX_wm_area
(
C
);
65
ARegion
*region =
text_has_properties_region
(
area
);
66
SpaceText
*
st
=
CTX_wm_space_text
(
C
);
67
68
if
(region) {
69
if
(region->
flag
&
RGN_FLAG_HIDDEN
) {
70
ED_region_toggle_hidden
(
C
, region);
71
}
72
73
UI_panel_category_active_set
(region,
"Text"
);
74
75
/* cannot send a button activate yet for case when region wasn't visible yet */
76
/* flag gets checked and cleared in main draw callback */
77
st
->flags |=
ST_FIND_ACTIVATE
;
78
79
ED_region_tag_redraw
(region);
80
}
81
return
OPERATOR_FINISHED
;
82
}
83
84
void
TEXT_OT_start_find
(
wmOperatorType
*
ot
)
85
{
86
/* identifiers */
87
ot
->
name
=
"Find"
;
88
ot
->
description
=
"Start searching text"
;
89
ot
->
idname
=
"TEXT_OT_start_find"
;
90
91
/* api callbacks */
92
ot
->
exec
=
text_text_search_exec
;
93
ot
->
poll
=
text_properties_poll
;
94
}
BKE_context.h
CTX_wm_area
struct ScrArea * CTX_wm_area(const bContext *C)
Definition:
context.c:738
CTX_wm_space_text
struct SpaceText * CTX_wm_space_text(const bContext *C)
Definition:
context.c:806
BKE_screen.h
BKE_area_find_region_type
struct ARegion * BKE_area_find_region_type(const struct ScrArea *area, int type)
BLI_blenlib.h
BLI_insertlinkafter
void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
Definition:
listbase.c:301
UNUSED
#define UNUSED(x)
Definition:
BLI_utildefines.h:671
RGN_FLAG_HIDDEN
@ RGN_FLAG_HIDDEN
Definition:
DNA_screen_types.h:698
RGN_TYPE_UI
@ RGN_TYPE_UI
Definition:
DNA_screen_types.h:646
RGN_TYPE_HEADER
@ RGN_TYPE_HEADER
Definition:
DNA_screen_types.h:643
RGN_ALIGN_LEFT
@ RGN_ALIGN_LEFT
Definition:
DNA_screen_types.h:680
ST_FIND_ACTIVATE
@ ST_FIND_ACTIVATE
Definition:
DNA_space_types.h:1442
DNA_windowmanager_types.h
OPERATOR_FINISHED
@ OPERATOR_FINISHED
Definition:
DNA_windowmanager_types.h:560
ED_screen.h
ED_region_toggle_hidden
void ED_region_toggle_hidden(struct bContext *C, struct ARegion *region)
Definition:
area.c:2117
ED_region_tag_redraw
void ED_region_tag_redraw(struct ARegion *region)
Definition:
area.c:655
MEM_guardedalloc.h
Read Guarded memory(de)allocation.
C
#define C
Definition:
RandGen.cpp:25
UI_interface.h
UI_panel_category_active_set
void UI_panel_category_active_set(struct ARegion *region, const char *idname)
Definition:
interface_panel.c:2208
WM_types.h
NULL
return NULL
Definition:
bmesh_operator_api_inline.h:205
MEM_callocN
void *(* MEM_callocN)(size_t len, const char *str)
Definition:
mallocn.c:31
blender::compositor::area
static void area(int d1, int d2, int e1, int e2, float weights[2])
Definition:
COM_SMAAOperation.cc:113
usdtokens::st
static const pxr::TfToken st("st", pxr::TfToken::Immortal)
ARegion
Definition:
DNA_screen_types.h:447
ARegion::flag
short flag
Definition:
DNA_screen_types.h:466
ARegion::alignment
short alignment
Definition:
DNA_screen_types.h:464
ARegion::regiontype
short regiontype
Definition:
DNA_screen_types.h:462
ScrArea
Definition:
DNA_screen_types.h:365
SpaceText
Definition:
DNA_space_types.h:1381
bContext
Definition:
context.c:56
wmOperatorType
Definition:
WM_types.h:886
wmOperatorType::name
const char * name
Definition:
WM_types.h:888
wmOperatorType::idname
const char * idname
Definition:
WM_types.h:890
wmOperatorType::poll
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition:
WM_types.h:943
wmOperatorType::description
const char * description
Definition:
WM_types.h:893
wmOperatorType::exec
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition:
WM_types.h:903
wmOperator
Definition:
DNA_windowmanager_types.h:522
TEXT_OT_start_find
void TEXT_OT_start_find(wmOperatorType *ot)
Definition:
text_header.c:84
text_text_search_exec
static int text_text_search_exec(bContext *C, wmOperator *UNUSED(op))
Definition:
text_header.c:62
text_properties_poll
static bool text_properties_poll(bContext *C)
Definition:
text_header.c:57
text_has_properties_region
static ARegion * text_has_properties_region(ScrArea *area)
Definition:
text_header.c:29
text_intern.h
ot
wmOperatorType * ot
Definition:
wm_files.c:3479
Generated on Sat Jul 27 2024 14:57:55 for Blender by
doxygen
1.9.1