Example #1
0
ActionWidget::ActionWidget(QWidget *parent) :
	QWidget(parent),
	ui(new Ui::Action)
{
	ui->setupUi(this);

	QString path = PRO_FILE_PWD;

	QDir dir(path + "/actionFiles");

	QStringList filter;
	filter.append("*.act");
	QStringList list = dir.entryList(filter, QDir::Files);

	connect(ui->startLoadButton, SIGNAL(clicked()), this, SLOT(startLoad()));
	connect(ui->stopLoadButton, SIGNAL(clicked()), this, SLOT(stopLoad()));

	connect(ui->startSaveButton, SIGNAL(clicked()), this, SLOT(startSave()));
	connect(ui->stopSaveButton, SIGNAL(clicked()), this, SLOT(stopSave()));

	ui->comboBox->addItems(list);
}
Example #2
0
  bool Cursynth::textInput(int key) {
    if (state_ == PATCH_LOADING) {
      int num_patches = patches_.size();
      switch(key) {
        case '\n':
          // Finish loading patches.
          state_ = STANDARD;
          gui_.clearPatches();
          return true;
        case KEY_UP:
          // Go to previous patch.
          patch_load_index_ = CLAMP(patch_load_index_ - 1, 0, num_patches - 1);
          gui_.drawPatchLoading(patches_, patch_load_index_);
          loadFromFile(patches_[patch_load_index_]);
          return true;
        case KEY_DOWN:
          // Go to next patch.
          patch_load_index_ = CLAMP(patch_load_index_ + 1, 0, num_patches - 1);
          gui_.drawPatchLoading(patches_, patch_load_index_);
          loadFromFile(patches_[patch_load_index_]);
          return true;
      }
    }

    std::string current_control = gui_.getCurrentControl();
    Control* control = controls_.at(current_control);
    bool should_redraw_control = false;
    lock();
    switch(key) {
      case 'H':
      case KEY_F(1):
        startHelp();
        break;
      case 'S':
        startSave();
        break;
      case 'L':
        startLoad();
        break;
      case 'M':
      case 'm':
        if (state_ != MIDI_LEARN)
          state_ = MIDI_LEARN;
        else
          state_ = STANDARD;
        should_redraw_control = true;
        break;
      case 'C':
      case 'c':
        eraseMidiLearn(control);
        state_ = STANDARD;
        should_redraw_control = true;
        break;
      case KEY_UP:
        current_control = gui_.getPrevControl();
        state_ = STANDARD;
        gui_.drawControl(control, false);
        should_redraw_control = true;
        break;
      case KEY_DOWN:
        current_control = gui_.getNextControl();
        state_ = STANDARD;
        gui_.drawControl(control, false);
        should_redraw_control = true;
        break;
      case KEY_RIGHT:
        control->increment();
        should_redraw_control = true;
        break;
      case KEY_LEFT:
        control->decrement();
        should_redraw_control = true;
        break;
      default:
        // Check if they pressed the slider keys and change the current value.
        size_t slider_size = strlen(SLIDER) - 1;
        for (size_t i = 0; i <= slider_size; ++i) {
          if (SLIDER[i] == key) {
            control->setPercentage((1.0 * i) / slider_size);
            should_redraw_control = true;
            break;
          }
        }

        // Check if they pressed note keys and play the corresponding note.
        for (size_t i = 0; i < strlen(KEYBOARD); ++i) {
          if (KEYBOARD[i] == key) {
            synth_.noteOn(48 + i);
            break;
          }
        }
    }

    if (should_redraw_control) {
      control = controls_.at(current_control);
      gui_.drawControl(control, true);
      gui_.drawControlStatus(control, state_ == MIDI_LEARN);
    }

    unlock();
    return true;
  }
Example #3
0
void Actor::save() {
  startSave("Actor");
  Creature::save();
  endSave();
}
Example #4
0
void ClientWindow::menuAction(int id,Point point)
 {
  switch( id )
    {
     case MenuFileNew :
      {
       if( editor.isModified() )
         {
          askSave(ContinueNew);
         }
       else
         {
          editor.blank();
         }
      }
     break;

     case MenuFileOpen :
      {
       if( editor.isModified() )
         {
          file_point=point;

          askSave(ContinueStartOpen);
         }
       else
         {
          startOpen(point);
         }
      }
     break;

     case MenuFileSave :
      {
       if( !editor.save() ) startSave(point);
      }
     break;

     case MenuFileSaveAs :
      {
       startSave(point);
      }
     break;

     case MenuFileExit :
      {
       askFrameClose();
      }
     break;

     case MenuOptionsUserPref :
      {
       doUserPref.assert(point);
      }
     break;

     case MenuOptionsAppPref :
      {
       doAppPref.assert(point);
      }
     break;
    }
 }