PatternFindReplace.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * PatternFindReplace.h
  3. * --------------------
  4. * Purpose: Implementation of the pattern search.
  5. * Notes : (currently none)
  6. * Authors: Olivier Lapicque
  7. * OpenMPT Devs
  8. * The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
  9. */
  10. #pragma once
  11. #include "openmpt/all/BuildSettings.hpp"
  12. // Find/Replace data
  13. struct FindReplace
  14. {
  15. static FindReplace instance;
  16. enum Flags
  17. {
  18. Note = 0x01, // Search for note
  19. Instr = 0x02, // Search for instrument
  20. VolCmd = 0x04, // Search for volume effect
  21. Volume = 0x08, // Search for volume
  22. Command = 0x10, // Search for effect
  23. Param = 0x20, // Search for effect parameter
  24. PCParam = 0x40, // Parameter of PC event
  25. PCValue = 0x80, // Value of PC event
  26. InChannels = 0x100, // Limit search to channels
  27. FullSearch = 0x200, // Search whole song
  28. InPatSelection = 0x400, // Search in current pattern selection
  29. Replace = 0x800, // Replace
  30. ReplaceAll = 0x1000, // Replace all
  31. };
  32. enum ReplaceMode
  33. {
  34. ReplaceValue,
  35. ReplaceRelative,
  36. ReplaceMultiply,
  37. };
  38. enum
  39. {
  40. ReplaceOctaveUp = 12000,
  41. ReplaceOctaveDown = -12000,
  42. };
  43. FlagSet<Flags> findFlags, replaceFlags; // See Flags
  44. // Data to replace with
  45. ReplaceMode replaceNoteAction, replaceInstrAction, replaceVolumeAction, replaceParamAction;
  46. int replaceNote, replaceInstr, replaceVolume, replaceParam;
  47. ModCommand::VOLCMD replaceVolCmd;
  48. ModCommand::COMMAND replaceCommand;
  49. // Data to find
  50. ModCommand::NOTE findNoteMin, findNoteMax;
  51. ModCommand::INSTR findInstrMin, findInstrMax;
  52. ModCommand::VOLCMD findVolCmd;
  53. int findVolumeMin, findVolumeMax;
  54. ModCommand::COMMAND findCommand;
  55. int findParamMin, findParamMax;
  56. PatternRect selection; // Find in this selection (if FindReplace::InPatSelection is set)
  57. CHANNELINDEX findChnMin, findChnMax; // Find in these channels (if FindReplace::InChannels is set)
  58. FindReplace();
  59. };
  60. DECLARE_FLAGSET(FindReplace::Flags);