コード例 #1
0
ファイル: TrackEditor.cpp プロジェクト: tedfelix/rosegarden
void
TrackEditor::deleteSelectedSegments()
{
    SegmentSelection segments = m_compositionView->getSelectedSegments();

    if (segments.empty())
        return;

    // Clear the selection before erasing the Segments
    // the selection points to
    //
    m_compositionView->getModel()->clearSelected();

    MacroCommand *macro = new MacroCommand(tr("Delete Segments"));

    // For each selected segment
    for (SegmentSelection::iterator it = segments.begin();
         it != segments.end();
         ++it) {
        macro->addCommand(new SegmentEraseCommand(*it,
                          &m_doc->getAudioFileManager()));
    }

    addCommandToHistory(macro);
}
コード例 #2
0
ファイル: TrackEditor.cpp プロジェクト: tedfelix/rosegarden
void
TrackEditor::turnLinkedSegmentsToRealCopies()
{
    RG_DEBUG << "turnLinkedSegmentsToRealCopies()";

    SegmentSelection segments = m_compositionView->getSelectedSegments();

    if (segments.empty())
        return;

    QString text = tr("Turn %n Linked Segment(s) into Real Copies", "", segments.size());

    MacroCommand *macro = new MacroCommand(text);

    // For each selected segment
    for (SegmentSelection::iterator it = segments.begin();
         it != segments.end();
         ++it) {
        if ((*it)->isLinked()) {
            macro->addCommand(new SegmentLinkToCopyCommand(*it));
        }
    }

    addCommandToHistory(macro);
}
コード例 #3
0
ファイル: TrackEditor.cpp プロジェクト: tedfelix/rosegarden
void TrackEditor::deleteTracks(std::vector<TrackId> tracks)
{
    MacroCommand *macro = new MacroCommand(tr("Delete Tracks"));

    Composition &comp = m_doc->getComposition();
    const SegmentMultiSet &segments = comp.getSegments();

    // Delete the segments.

    // for each track we are deleting
    for (size_t i = 0; i < tracks.size(); ++i) {
        const TrackId trackId = tracks[i];

        // for each segment in the composition
        for (SegmentMultiSet::const_iterator segmentIter = segments.begin();
             segmentIter != segments.end();
             ++segmentIter) {
            Segment *segment = *segmentIter;

            // if this segment is in the track
            if (segment->getTrack() == trackId) {
                macro->addCommand(new SegmentEraseCommand(
                        segment, &m_doc->getAudioFileManager()));
            }
        }
    }

    // Delete the tracks.
    macro->addCommand(new DeleteTracksCommand(&comp, tracks));

    addCommandToHistory(macro);
}
コード例 #4
0
void
ControlEditorDialog::slotEdit(QTreeWidgetItem *i, int)
{
    RG_DEBUG << "ControlEditorDialog::slotEdit" << endl;

    ControlParameterItem *item =
        dynamic_cast<ControlParameterItem*>(i);

    MidiDevice *md =
        dynamic_cast<MidiDevice *>(m_studio->getDevice(m_device));

    if (item && md) {
        ControlParameterEditDialog dialog
        (this,
         md->getControlParameter(item->getId()), m_doc);

        if (dialog.exec() == QDialog::Accepted) {
            ModifyControlParameterCommand *command =
                new ModifyControlParameterCommand(m_studio,
                                                  m_device,
                                                  dialog.getControl(),
                                                  item->getId());

            addCommandToHistory(command);
        }
    }
}
コード例 #5
0
void OcaOctaveController::runCommand( const QString& command, OcaTrackGroup* group )
{
  if( e_StateReady == m_state ) {
    m_state = e_StateWaiting;
    m_lastError = 0;
    m_lastErrorString.clear();
    QStringList list = command.split( '\n' );
    QString command_fixed;
    for( int i = 0; i < list.size(); i++ ) {
      QString s = list.at(i).trimmed();
      if( ! s.isEmpty() ) {
        if( ! command_fixed.isEmpty() ) {
          command_fixed.append( '\n' );
        }
        command_fixed.append( s );
      }
    }

    fprintf( stderr, "OcaOctaveController => WAITING\n" );
    addCommandToHistory( command_fixed );
    m_host->evalCommand( command_fixed, group );
    emit readyStateChanged( false, 0 );
  }
  else {
    emit outputReceived( "OcaOctaveController::runCommand failed: not ready", 128 );
    fprintf( stderr, "OcaOctaveController => ERROR (not ready)\n" );
  }
}
コード例 #6
0
ファイル: TrackEditor.cpp プロジェクト: tedfelix/rosegarden
void TrackEditor::addSegment(int track, int time, unsigned int duration)
{
    if (!m_doc)
        return ; // sanity check

    SegmentInsertCommand *command =
        new SegmentInsertCommand(m_doc, track, time, duration);

    addCommandToHistory(command);
}
コード例 #7
0
ファイル: TrackEditor.cpp プロジェクト: tedfelix/rosegarden
void TrackEditor::addTracks(unsigned int nbNewTracks,
                            InstrumentId id,
                            int position)
{
    Composition &comp = m_doc->getComposition();

    addCommandToHistory(new AddTracksCommand(&comp, nbNewTracks, id, position));

    updateCanvasSize();
}
コード例 #8
0
ファイル: SegmentEraser.cpp プロジェクト: UIKit0/rosegarden
void SegmentEraser::handleMouseButtonRelease(QMouseEvent*)
{
    if (m_currentIndex) {
        // no need to test the result, we know it's good (see handleMouseButtonPress)
        CompositionItem* item = m_currentIndex;

        addCommandToHistory(new SegmentEraseCommand(item->getSegment()));
    }

    setCurrentIndex(CompositionItemPtr());
}
コード例 #9
0
void
ControlEditorDialog::slotAdd()
{
    RG_DEBUG << "ControlEditorDialog::slotAdd to device " << m_device << endl;

    AddControlParameterCommand *command =
        new AddControlParameterCommand(m_studio, m_device,
                                       ControlParameter());

    addCommandToHistory(command);
    slotUpdate(true);
}
コード例 #10
0
void
ControlEditorDialog::slotDelete()
{
    RG_DEBUG << "ControlEditorDialog::slotDelete" << endl;

    if(! m_treeWidget->currentItem())
        return ;

    ControlParameterItem *item =
        dynamic_cast<ControlParameterItem*>(m_treeWidget->currentItem());

    if (item) {
        RemoveControlParameterCommand *command =
            new RemoveControlParameterCommand(m_studio, m_device, item->getId());

        addCommandToHistory(command);
    }
}
コード例 #11
0
void RKConsole::submitCommand () {
	RK_TRACE (APP);

	QString current_line = currentCommand ();
	QString command = current_line;
	addCommandToHistory (current_line);
	
	if (command_incomplete) {
		command.prepend (incomplete_command + '\n');
	}

	doc->insertText (doc->numLines () - 1, editInterface (doc)->lineLength (doc->numLines () -1), "\n");
	if (!current_line.isEmpty ()) {
		current_command = new RCommand (command, RCommand::User | RCommand::Console, QString::null, this);
		RKGlobals::rInterface ()->issueCommand (current_command);
		interrupt_command_action->setEnabled (true);
	} else {
		tryNextInBatch ();
	}
}
コード例 #12
0
int tokenizeAndProcessCommand(char* buff, char* tokens[], _Bool* in_background) {
	// Add command in buff to history if not !n, !!, or carriage return (newline)
	if (buff[0] != '!' && buff[0] != '\0') {
		addCommandToHistory(buff);
	}

	int token_count = tokenize_command(buff, tokens);
	if (token_count == 0) {
		//error
		return 0;
	}

	// Extract & if running in background:
	if (token_count > 0 && strcmp(tokens[token_count - 1], "&") == 0) {
		*in_background = true;
		tokens[token_count - 1] = 0;
	}

	// tokenizing and processing successful
	return 1;
}
コード例 #13
0
ファイル: ChatControl.cpp プロジェクト: inetra/peers1
void ChatControl::onSend() {
  const int messageLength = ctrlMessage.GetWindowTextLength();
  if (messageLength > 0) {
    AutoArray<TCHAR> msg(messageLength + 1);
    ctrlMessage.GetWindowText(msg, messageLength + 1);
    tstring s(msg, messageLength);
    addCommandToHistory(s);
    if (ChatCommandContext::isCommand(s)) {
      ChatCommandContext context(s);
      processCommand(context);
      if (context.clearMessageWindow) {
        ctrlMessage.SetWindowText(_T(""));
      }
    }
    else {
      m_listener->chatSendMessage(s);
      ctrlMessage.SetWindowText(_T(""));
    }
  }
  else {
    MessageBeep(MB_ICONEXCLAMATION);
  }
}
コード例 #14
0
ファイル: shell.c プロジェクト: Grotke/shell
int main(){
	while(should_run){
		startNewLine();
		while(hasMoreCharacters){
			currentChar = getc(stdin);
			handleCharacter();
			checkAndHandleEndOfLine();
		}

		checkAndHandleHistoryCommands();

		addCommandToHistory(args, background, tokenNumber);
		int returnCode = handleCommand(background);

		if(returnCode != -1){
			return returnCode;
		}
	
		exitIfCommanded();
		resetArguments(tokenNumber);
	}

	return 0;
}
コード例 #15
0
int main (int argc, const char * argv[])
{
    char *line;
    pipeline pl;
    char *promptstr;

    initHistory();
    initJobs();

    /* check for the right number of arguments */
    if(argc >= 2)
    {
        FILE* theFile = fopen(argv[1], "r");
        if(theFile == NULL)
        {
            if(errno == ENOENT)
            {
                fprintf(stderr, "%s: Command not found.\n", argv[1]);
            }
            else
            {
                perror("fopen");
            }
            exit(-1);
        }
        if(dup2(fileno(theFile), STDIN_FILENO) == -1)
        {
            perror("dup2");
            exit(-1);
        }
        fclose(theFile);
    }

    /* set prompt */
    promptstr = PROMPT;

    prompt(promptstr);
    while ( TRUE )
    {
        if ( NULL == (line = readLongString(stdin)))
        {
            if ( feof(stdin) )
            {
                /* end of the input file, we're done */
                exit(0);
            }
        }
        else if(line[0] == '\0')
        {
            /* do nothing */
        }
        else
        {
            /* line is added to history list, and freed from there */
            /* copyLine is sent to pipeline, and freed from there */
            /* jobs need their own copy of the command_line */
            char* copyLine = newstr(line);
            /* We got a line, send it off to the pipeline cracker and
            * launch it
            */
            pl = crack_pipeline(copyLine);
            if(pl != NULL)
            {
                addCommandToHistory(line);
                runPipeline(pl);
            }
            free_pipeline(pl);

            lineno++;  /* readLongString trims newlines, so increment it manually */
        }
        fflush(stdout);
        //tcsetpgrp(STDIN_FILENO, getpgid(0));
        prompt(promptstr);
    }

    return 0;

}