Rosegarden – music editor and MIDI/audio sequencer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
3.4KB

  1. /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
  2. /*
  3. Rosegarden
  4. A MIDI and audio sequencer and musical notation editor.
  5. This program is Copyright 2000-2008
  6. Guillaume Laurent <glaurent@telegraph-road.org>,
  7. Chris Cannam <cannam@all-day-breakfast.com>,
  8. Richard Bown <richard.bown@ferventsoftware.com>
  9. The moral rights of Guillaume Laurent, Chris Cannam, and Richard
  10. Bown to claim authorship of this work have been asserted.
  11. Other copyrights also apply to some parts of this work. Please
  12. see the AUTHORS file and individual file headers for details.
  13. This program is free software; you can redistribute it and/or
  14. modify it under the terms of the GNU General Public License as
  15. published by the Free Software Foundation; either version 2 of the
  16. License, or (at your option) any later version. See the file
  17. COPYING included with this distribution for more information.
  18. */
  19. #include "AddMarkCommand.h"
  20. #include <tdelocale.h>
  21. #include "misc/Strings.h"
  22. #include "base/Selection.h"
  23. #include "document/BasicSelectionCommand.h"
  24. #include "base/BaseProperties.h"
  25. #include <tqstring.h>
  26. namespace Rosegarden
  27. {
  28. using namespace BaseProperties;
  29. TQString
  30. AddMarkCommand::getGlobalName(Mark markType)
  31. {
  32. TQString m = strtoqstr(markType);
  33. // Gosh, lots of collisions
  34. if (markType == Marks::Sforzando)
  35. m = i18n("S&forzando");
  36. else if (markType == Marks::Staccato)
  37. m = i18n("Sta&ccato");
  38. else if (markType == Marks::Rinforzando)
  39. m = i18n("R&inforzando");
  40. else if (markType == Marks::Tenuto)
  41. m = i18n("T&enuto");
  42. else if (markType == Marks::Trill)
  43. m = i18n("Tri&ll");
  44. else if (markType == Marks::LongTrill)
  45. m = i18n("Trill &with Line");
  46. else if (markType == Marks::TrillLine)
  47. m = i18n("Trill Line");
  48. else if (markType == Marks::Turn)
  49. m = i18n("&Turn");
  50. else if (markType == Marks::Accent)
  51. m = i18n("&Accent");
  52. else if (markType == Marks::Staccatissimo)
  53. m = i18n("&Staccatissimo");
  54. else if (markType == Marks::Marcato)
  55. m = i18n("&Marcato");
  56. else if (markType == Marks::Pause)
  57. m = i18n("&Pause");
  58. else if (markType == Marks::UpBow)
  59. m = i18n("&Up-Bow");
  60. else if (markType == Marks::DownBow)
  61. m = i18n("&Down-Bow");
  62. else if (markType == Marks::Mordent)
  63. m = i18n("Mo&rdent");
  64. else if (markType == Marks::MordentInverted)
  65. m = i18n("Inverted Mordent");
  66. else if (markType == Marks::MordentLong)
  67. m = i18n("Long Mordent");
  68. else if (markType == Marks::MordentLongInverted)
  69. m = i18n("Lon&g Inverted Mordent");
  70. else
  71. m = i18n("&%1%2").arg(m[0].upper()).arg(m.right(m.length() - 1));
  72. // FIXME: That last i18n has very little chance of working, unless
  73. // by some miracle the exact same string was translated elsewhere already
  74. // but we'll leave it as a warning
  75. m = i18n("Add %1").arg(m);
  76. return m;
  77. }
  78. void
  79. AddMarkCommand::modifySegment()
  80. {
  81. EventSelection::eventcontainer::iterator i;
  82. for (i = m_selection->getSegmentEvents().begin();
  83. i != m_selection->getSegmentEvents().end(); ++i) {
  84. long n = 0;
  85. (*i)->get
  86. <Int>(MARK_COUNT, n);
  87. (*i)->set
  88. <Int>(MARK_COUNT, n + 1);
  89. (*i)->set
  90. <String>(getMarkPropertyName(n),
  91. m_mark);
  92. }
  93. }
  94. }