MCPcopy Create free account
hub / github.com/HertzDevil/0CC-FamiTracker / CopyNoteSection

Function CopyNoteSection

Source/PatternEditor.cpp:68–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66// // //
67
68void CopyNoteSection(stChanNote &Target, const stChanNote &Source, paste_mode_t Mode, column_t Begin, column_t End) // // //
69{
70 const auto isNoteProtected = [Mode] (const stChanNote &dest, const stChanNote &src) {
71 constexpr stChanNote BLANK { };
72 switch (Mode) {
73 case paste_mode_t::MIX:
74 if (dest.Note != BLANK.Note)
75 return true;
76 if (FTEnv.GetSettings()->General.iEditStyle == edit_style_t::IT)
77 if (dest.Instrument != BLANK.Instrument || dest.Vol != BLANK.Vol)
78 return true;
79 [[fallthrough]];
80 case paste_mode_t::OVERWRITE:
81 if (src.Note == BLANK.Note)
82 return true;
83 }
84 return false;
85 };
86
87 const auto isInstProtected = [Mode] (const stChanNote &dest, const stChanNote &src) {
88 constexpr stChanNote BLANK { };
89 switch (Mode) {
90 case paste_mode_t::MIX:
91 if (dest.Instrument != BLANK.Instrument)
92 return true;
93 if (FTEnv.GetSettings()->General.iEditStyle == edit_style_t::IT)
94 if (dest.Note != BLANK.Note || dest.Vol != BLANK.Vol)
95 return true;
96 [[fallthrough]];
97 case paste_mode_t::OVERWRITE:
98 if (src.Instrument == BLANK.Instrument)
99 return true;
100 }
101 return false;
102 };
103
104 const auto isVolProtected = [Mode] (const stChanNote &dest, const stChanNote &src) {
105 constexpr stChanNote BLANK { };
106 switch (Mode) {
107 case paste_mode_t::MIX:
108 if (dest.Vol != BLANK.Vol)
109 return true;
110 if (FTEnv.GetSettings()->General.iEditStyle == edit_style_t::IT)
111 if (dest.Note != BLANK.Note || dest.Instrument != BLANK.Instrument || dest.Vol != BLANK.Vol)
112 return true;
113 [[fallthrough]];
114 case paste_mode_t::OVERWRITE:
115 if (src.Vol == BLANK.Vol)
116 return true;
117 }
118 return false;
119 };
120
121 const auto isFxProtected = [Mode] (const stChanNote &dest, const stChanNote &src, std::size_t fx) {
122 constexpr stChanNote BLANK { };
123 switch (Mode) {
124 case paste_mode_t::MIX:
125 if (dest.Effects[fx].fx != BLANK.Effects[fx].fx)

Callers 4

PasteMethod · 0.85
PasteRawMethod · 0.85
DeleteSelectionMethod · 0.85
RedoMethod · 0.85

Calls 3

swapFunction · 0.85
value_castFunction · 0.85
GetSettingsMethod · 0.45

Tested by

no test coverage detected