aboutsummaryrefslogtreecommitdiff
path: root/Src/external_dependencies/openmpt-trunk/mptrack/PatternFindReplace.h
blob: 6266213d436dca181689241794cb5a6f8963792c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
 * PatternFindReplace.h
 * --------------------
 * Purpose: Implementation of the pattern search.
 * Notes  : (currently none)
 * Authors: Olivier Lapicque
 *          OpenMPT Devs
 * The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
 */

#pragma once

#include "openmpt/all/BuildSettings.hpp"

// Find/Replace data
struct FindReplace
{
	static FindReplace instance;

	enum Flags
	{
		Note			= 0x01,		// Search for note
		Instr			= 0x02,		// Search for instrument
		VolCmd			= 0x04,		// Search for volume effect
		Volume			= 0x08,		// Search for volume
		Command			= 0x10,		// Search for effect
		Param			= 0x20,		// Search for effect parameter
		PCParam			= 0x40,		// Parameter of PC event
		PCValue			= 0x80,		// Value of PC event

		InChannels		= 0x100,	// Limit search to channels
		FullSearch		= 0x200,	// Search whole song
		InPatSelection	= 0x400,	// Search in current pattern selection
		Replace			= 0x800,	// Replace
		ReplaceAll		= 0x1000,	// Replace all
	};

	enum ReplaceMode
	{
		ReplaceValue,
		ReplaceRelative,
		ReplaceMultiply,
	};

	enum
	{
		ReplaceOctaveUp   =  12000,
		ReplaceOctaveDown = -12000,
	};

	FlagSet<Flags> findFlags, replaceFlags;	// See Flags

	// Data to replace with
	ReplaceMode replaceNoteAction, replaceInstrAction, replaceVolumeAction, replaceParamAction;
	int replaceNote, replaceInstr, replaceVolume, replaceParam;
	ModCommand::VOLCMD  replaceVolCmd;
	ModCommand::COMMAND replaceCommand;

	// Data to find
	ModCommand::NOTE    findNoteMin, findNoteMax;
	ModCommand::INSTR   findInstrMin, findInstrMax;
	ModCommand::VOLCMD  findVolCmd;
	int                 findVolumeMin, findVolumeMax;
	ModCommand::COMMAND findCommand;
	int                 findParamMin, findParamMax;

	PatternRect selection;					// Find in this selection (if FindReplace::InPatSelection is set)
	CHANNELINDEX findChnMin, findChnMax;	// Find in these channels (if FindReplace::InChannels is set)

	FindReplace();
};

DECLARE_FLAGSET(FindReplace::Flags);