Esempio n. 1
0
void parseLine(String str) {
	if (str.empty()) { return; }
	if ( parseSetCommand( str ) ) { return; }
	
	std::stringstream ss;
	ss.str(str);
	ss >> str;
	
	if ( (str[0] >= '0') && (str[0] <= '9') ) {	
		int dest = std::stoi(str);
		if ( (dest < 0) || (dest >= indexes) ) { return; }
		for ( int i = currentLine; i < currentLine + noteLength; ++i ) {
			outputFiles[dest] << lines[i] << "\n";
		}
		removeCurrentNote();
		return;
	}
	
	if ( str == "save" ) {
		saveState();
	} else if ( str == "s" ) {
		if (currentLine != (int)lines.size()) {
			log.push_back( String("Skipped ") + std::to_string(currentLine) );
		}
		int before = currentLine;
		getNextNoteLine();
		if ((before != currentLine) && (currentLine == (int)lines.size())) {
			log.push_back("Reached End of Input");
		}
		return;
	}
	if ( str == "i" ) {
		std::cout << "Insert Custom Note > ";
		String line;
		getline(std::cin, line);
		if ( !isBlankLine(line) ) {
			lines.insert( lines.begin() + currentLine, line );
		}
	}
	if ( str == "d" ) {
		log.push_back( String("Deleted ") + std::to_string(currentLine) );
		removeCurrentNote();
	}
	if ( str == "p" ) {
		log.push_back("Previous");
		--currentLine;
		currentLine = std::max(0, currentLine);
	}
	if ( str == "q" ) {
		doQuit = true;
		return;
	}
	if ( str == "\t" ) {
		enterSubNote();
	}
	
	ss.str("");
	ss.clear();
}
Esempio n. 2
0
void TmultiScore::deleteNotes() {
  if (!staff()->count())
      return; // nothing to delete
  m_currentIndex = 0;
  while (staffCount() > 1)
    deleteLastStaff();
  if (staff()->count() > 1) {
    QList<TscoreNote*> notesToDel;
    staff()->takeNotes(notesToDel, 1, staff()->count() - 1);
    for (int i = 0; i <notesToDel.size(); i++)
      delete notesToDel[i];
  }
  removeCurrentNote();
  updateSceneRect();
  m_currentIndex = -1;
}