Exemple #1
0
Arranger::custom_col_t Arranger::readOneCustomColumn(MusECore::Xml& xml)
{
      custom_col_t temp(0, "-");
      
      for (;;) {
            MusECore::Xml::Token token(xml.parse());
            const QString& tag(xml.s1());
            switch (token) {
                  case MusECore::Xml::Error:
                  case MusECore::Xml::End:
                        return temp;
                  case MusECore::Xml::TagStart:
                        if (tag == "name")
                              temp.name=xml.parse1();
                        else if (tag == "ctrl")
                              temp.ctrl=xml.parseInt();
                        else if (tag == "affected_pos")
                              temp.affected_pos=(custom_col_t::affected_pos_t)xml.parseInt();
                        else
                              xml.unknown("Arranger::readOneCustomColumn");
                        break;
                  case MusECore::Xml::TagEnd:
                        if (tag == "column")
                              return temp;
                  default:
                        break;
                  }
            }
      return temp;
}
Exemple #2
0
void Arranger::readConfiguration(MusECore::Xml& xml)
      {
      for (;;) {
            MusECore::Xml::Token token(xml.parse());
            const QString& tag(xml.s1());
            switch (token) {
                  case MusECore::Xml::Error:
                  case MusECore::Xml::End:
                        return;
                  case MusECore::Xml::TagStart:
                        if (tag == "tlist_header")
                              header_state = QByteArray::fromHex(xml.parse1().toLatin1());
                        else if (tag == "custom_columns")
                              readCustomColumns(xml);
                        else
                              xml.unknown("Arranger");
                        break;
                  case MusECore::Xml::TagEnd:
                        if (tag == "arranger")
                              return;
                  default:
                        break;
                  }
            }
      }
Exemple #3
0
void Arranger::readCustomColumns(MusECore::Xml& xml)
{
      custom_columns.clear();
      
      for (;;) {
            MusECore::Xml::Token token(xml.parse());
            const QString& tag(xml.s1());
            switch (token) {
                  case MusECore::Xml::Error:
                  case MusECore::Xml::End:
                        new_custom_columns=custom_columns;
                        return;
                  case MusECore::Xml::TagStart:
                        if (tag == "column")
                              custom_columns.push_back(readOneCustomColumn(xml));
                        else
                              xml.unknown("Arranger::readCustomColumns");
                        break;
                  case MusECore::Xml::TagEnd:
                        if (tag == "custom_columns")
                        {
                              new_custom_columns=custom_columns;
                              return;
                        }
                  default:
                        break;
                  }
            }
}
Exemple #4
0
void WaveEdit::readStatus(MusECore::Xml& xml)
      {
      for (;;) {
            MusECore::Xml::Token token = xml.parse();
            if (token == MusECore::Xml::Error || token == MusECore::Xml::End)
                  break;
            QString tag = xml.s1();
            switch (token) {
                  case MusECore::Xml::TagStart:
                        if (tag == "midieditor")
                              MidiEditor::readStatus(xml);
                        else if (tag == "tool") {
                              int tool = xml.parseInt();
                              canvas->setTool(tool);
                              tools2->set(tool);
                              }
                        else if (tag == "xmag")
                              hscroll->setMag(xml.parseInt());
                        else if (tag == "ymag")
                              ymag->setValue(xml.parseInt());
                        else if (tag == "xpos")
                              hscroll->setPos(xml.parseInt());
                        else
                              xml.unknown("WaveEdit");
                        break;
                  case MusECore::Xml::TagEnd:
                        if (tag == "waveedit")
                              return;
                  default:
                        break;
                  }
            }
      }
Exemple #5
0
void Remove::read_configuration(MusECore::Xml& xml)
{
	for (;;)
	{
		MusECore::Xml::Token token = xml.parse();
		if (token == MusECore::Xml::Error || token == MusECore::Xml::End)
			break;
			
		const QString& tag = xml.s1();
		switch (token)
		{
			case MusECore::Xml::TagStart:
				if (tag == "range")
					range=xml.parseInt();
				else if (tag == "velo_threshold")
					velo_threshold=xml.parseInt();
				else if (tag == "velo_thres_used")
					velo_thres_used=xml.parseInt();
				else if (tag == "len_threshold")
					len_threshold=xml.parseInt();
				else if (tag == "len_thres_used")
					len_thres_used=xml.parseInt();
				else
					xml.unknown("Erase");
				break;
				
			case MusECore::Xml::TagEnd:
				if (tag == "erase")
					return;
				
			default:
				break;
		}
	}
}
Exemple #6
0
void Crescendo::read_configuration(MusECore::Xml& xml)
{
	for (;;)
	{
		MusECore::Xml::Token token = xml.parse();
		if (token == MusECore::Xml::Error || token == MusECore::Xml::End)
			break;
			
		const QString& tag = xml.s1();
		switch (token)
		{
			case MusECore::Xml::TagStart:
				if (tag == "range")
					range=xml.parseInt();
				else if (tag == "start")
					start_val=xml.parseInt();
				else if (tag == "end")
					end_val=xml.parseInt();
				else if (tag == "absolute")
					absolute=xml.parseInt();
				else
					xml.unknown("Crescendo");
				break;
				
			case MusECore::Xml::TagEnd:
				if (tag == "crescendo")
					return;
				
			default:
				break;
		}
	}
}
Exemple #7
0
void ArrangerView::readConfiguration(MusECore::Xml& xml)
      {
      for (;;) {
            MusECore::Xml::Token token = xml.parse();
            const QString& tag = xml.s1();
            switch (token) {
                  case MusECore::Xml::Error:
                  case MusECore::Xml::End:
                        return;
                  case MusECore::Xml::TagStart:
                        if (tag == "topwin")
                              TopWin::readConfiguration(ARRANGER, xml);
                        else if (tag == "arranger")
                              Arranger::readConfiguration(xml);
                        else
                              xml.unknown("ArrangerView");
                        break;
                  case MusECore::Xml::TagEnd:
                        if (tag == "arrangerview")
                              return;
                  default:
                        break;
                  }
            }
      }
Exemple #8
0
void Move::read_configuration(MusECore::Xml& xml)
{
	for (;;)
	{
		MusECore::Xml::Token token = xml.parse();
		if (token == MusECore::Xml::Error || token == MusECore::Xml::End)
			break;
			
		const QString& tag = xml.s1();
		switch (token)
		{
			case MusECore::Xml::TagStart:
				if (tag == "range")
					range=xml.parseInt();
				else if (tag == "amount")
					amount=xml.parseInt();
				else
					xml.unknown("Move");
				break;
				
			case MusECore::Xml::TagEnd:
				if (tag == "move")
					return;
				
			default:
				break;
		}
	}
}
Exemple #9
0
void WaveEdit::readConfiguration(MusECore::Xml& xml)
      {
      for (;;) {
            MusECore::Xml::Token token = xml.parse();
            const QString& tag = xml.s1();
            switch (token) {
                  case MusECore::Xml::TagStart:
                        if (tag == "bgcolor")
                              MusEGlobal::config.waveEditBackgroundColor = readColor(xml);
                        else if (tag == "raster")
                              _rasterInit = xml.parseInt();
                        else if (tag == "colormode")
                              colorModeInit = xml.parseInt();
                        else if (tag == "topwin")
                              TopWin::readConfiguration(WAVE, xml);
                        else
                              xml.unknown("WaveEdit");
                        break;
                  case MusECore::Xml::TagEnd:
                        if (tag == "waveedit")
                              return;
                  default:
                        break;
                  case MusECore::Xml::Error:
                  case MusECore::Xml::End:
                        return;
                  }
            }
      }
Exemple #10
0
void ArrangerView::readStatus(MusECore::Xml& xml)
{
  for (;;)
  {
    MusECore::Xml::Token token = xml.parse();
    if (token == MusECore::Xml::Error || token == MusECore::Xml::End)
      break;
      
    const QString& tag = xml.s1();
    switch (token)
    {
      case MusECore::Xml::TagStart:
        if (tag == "tool") 
          editTools->set(xml.parseInt());
        else if (tag == "topwin") 
          TopWin::readStatus(xml);
        else if (tag == "arranger") 
          arranger->readStatus(xml);
        else
          xml.unknown("ArrangerView");
        break;

      case MusECore::Xml::TagEnd:
        if (tag == "arrangerview")
          return;
          
      default:
        break;
    }
  }
}
Exemple #11
0
void MidiEditor::readStatus(MusECore::Xml& xml)
      {
      if (_pl == 0)
            _pl = new MusECore::PartList;

      for (;;) {
            MusECore::Xml::Token token = xml.parse();
            QString tag = xml.s1();
            switch (token) {
                  case MusECore::Xml::Error:
                  case MusECore::Xml::End:
                        return;
                  case MusECore::Xml::TagStart:
                        if (tag == "raster")
                              _raster = xml.parseInt();
                        else if (tag == "topwin")
                              TopWin::readStatus(xml);
                        else
                              xml.unknown("MidiEditor");
                        break;
                  case MusECore::Xml::TagEnd:
                        if (tag == "midieditor")
                              return;
                  default:
                        break;
                  }
            }
      }
Exemple #12
0
void Remove::read_configuration(MusECore::Xml& xml)
{
	for (;;)
	{
		MusECore::Xml::Token token = xml.parse();
		if (token == MusECore::Xml::Error || token == MusECore::Xml::End)
			break;
			
		const QString& tag = xml.s1();
		switch (token)
		{
			case MusECore::Xml::TagStart:
        
				//-----------------------------------------
				// Handle any common base settings.
				//-----------------------------------------
				
				if(!FunctionDialogBase::read_configuration(tag, xml))
				{
					//-----------------------------------------
					// Handle this dialog's specific settings.
					//-----------------------------------------
					
					if (tag == "range")
						_range = xml.parseInt();
					else if (tag == "parts")
						_parts = xml.parseInt();
					else if (tag == "velo_threshold")
						velo_threshold=xml.parseInt();
					else if (tag == "velo_thres_used")
						velo_thres_used=xml.parseInt();
					else if (tag == "len_threshold")
						len_threshold=xml.parseInt();
					else if (tag == "len_thres_used")
						len_thres_used=xml.parseInt();
					else
						xml.unknown("Erase");
				}
				break;
				
			case MusECore::Xml::TagEnd:
				if (tag == "erase")
					return;
				
			default:
				break;
		}
	}
}
Exemple #13
0
void GateTime::read_configuration(MusECore::Xml& xml)
{
	for (;;)
	{
		MusECore::Xml::Token token = xml.parse();
		if (token == MusECore::Xml::Error || token == MusECore::Xml::End)
			break;
			
		const QString& tag = xml.s1();
		switch (token)
		{
			case MusECore::Xml::TagStart:
				        
				//-----------------------------------------
				// Handle any common base settings.
				//-----------------------------------------
				
				if(!FunctionDialogBase::read_configuration(tag, xml))
				{
					//-----------------------------------------
					// Handle this dialog's specific settings.
					//-----------------------------------------
					
					if (tag == "range")
						_range = xml.parseInt();
					else if (tag == "parts")
						_parts = xml.parseInt();
					else if (tag == "rate")
						rateVal=xml.parseInt();
					else if (tag == "offset")
						offsetVal=xml.parseInt();
					else
						xml.unknown("ModLen");
				}
				break;
				
			case MusECore::Xml::TagEnd:
				if (tag == "mod_len")
					return;
				
			default:
				break;
		}
	}
}
Exemple #14
0
void TopWin::readConfiguration(ToplevelType t, MusECore::Xml& xml)
{
	if (initInited==false)
		initConfiguration();

	for (;;)
	{
		MusECore::Xml::Token token = xml.parse();
		if (token == MusECore::Xml::Error || token == MusECore::Xml::End)
			break;
			
		const QString& tag = xml.s1();
		switch (token)
		{
			case MusECore::Xml::TagStart:
				if (tag == "width")
					_widthInit[t] = xml.parseInt();
				else if (tag == "height")
					_heightInit[t] = xml.parseInt();
				else if (tag == "nonshared_toolbars")
					_toolbarNonsharedInit[t] = QByteArray::fromHex(xml.parse1().toAscii());
				else if (tag == "shared_toolbars")
					_toolbarSharedInit[t] = QByteArray::fromHex(xml.parse1().toAscii());
				else if (tag == "shares_when_free")
					_sharesWhenFree[t] = xml.parseInt();
				else if (tag == "shares_when_subwin")
					_sharesWhenSubwin[t] = xml.parseInt();
				else if (tag == "default_subwin")
					_defaultSubwin[t] = xml.parseInt();
				else
					xml.unknown("TopWin");
				break;

			case MusECore::Xml::TagEnd:
				if (tag == "topwin")
					return;

			default:
				break;
		}
	}
}
Exemple #15
0
void LMaster::readStatus(MusECore::Xml& xml)
      {
      for (;;) {
            MusECore::Xml::Token token = xml.parse();
            const QString& tag = xml.s1();
            if (token == MusECore::Xml::Error || token == MusECore::Xml::End)
                  break;
            switch (token) {
                  case MusECore::Xml::TagStart:
                        if (tag == "midieditor")
                              MidiEditor::readStatus(xml);
                        else
                              xml.unknown("LMaster");
                        break;
                  case MusECore::Xml::TagEnd:
                        if (tag == "lmaster")
                              return;
                  default:
                        break;
                  }
            }
      }
Exemple #16
0
void ClipListEdit::readStatus(MusECore::Xml& xml)
      {
      for (;;) {
            MusECore::Xml::Token token = xml.parse();
            const QString& tag = xml.s1();
            if (token == MusECore::Xml::Error || token == MusECore::Xml::End)
                  break;
            switch (token) {
                  case MusECore::Xml::TagStart:
                        if (tag == "topwin")
                              TopWin::readStatus(xml);
                        else
                              xml.unknown("CliplistEdit");
                        break;
                  case MusECore::Xml::TagEnd:
                        if (tag == "cliplist")
                              return;
                  default:
                        break;
                  }
            }
      }
Exemple #17
0
void Arranger::readStatus(MusECore::Xml& xml)
      {
      int rast = -1;  
      for (;;) {
            MusECore::Xml::Token token(xml.parse());
            const QString& tag(xml.s1());
            switch (token) {
                  case MusECore::Xml::Error:
                  case MusECore::Xml::End:
                        return;
                  case MusECore::Xml::TagStart:
                        if (tag == "raster")
                              rast = xml.parseInt();
                        else if (tag == "info")
                              showTrackinfoFlag = xml.parseInt();
                        else if (tag == split->objectName())
                              split->readStatus(xml);
                        else if (tag == "xmag")
                              hscroll->setMag(xml.parseInt());
                        else if (tag == "xpos") 
                              hscroll->setPos(xml.parseInt());  
                        else if (tag == "ypos")
                              vscroll->setValue(xml.parseInt());
                        else
                              xml.unknown("Arranger");
                        break;
                  case MusECore::Xml::TagEnd:
                        if (tag == "arranger") {
                              ib->setChecked(showTrackinfoFlag);
                              if(rast != -1)
                                setRasterVal(rast);
                              return;
                              }
                  default:
                        break;
                  }
            }
      }
Exemple #18
0
void LMaster::readConfiguration(MusECore::Xml& xml)
      {
      for (;;) {
            MusECore::Xml::Token token = xml.parse();
            const QString& tag = xml.s1();
            switch (token) {
                  case MusECore::Xml::Error:
                  case MusECore::Xml::End:
                        return;
                  case MusECore::Xml::TagStart:
                        if (tag == "topwin")
                              TopWin::readConfiguration(LMASTER, xml);
                        else
                              xml.unknown("LMaster");
                        break;
                  case MusECore::Xml::TagEnd:
                        if (tag == "lmaster")
                              return;
                  default:
                        break;
                  }
            }
      }
Exemple #19
0
void ClipListEdit::readConfiguration(MusECore::Xml& xml)
      {
      for (;;) {
            MusECore::Xml::Token token = xml.parse();
            const QString& tag = xml.s1();
            switch (token) {
                  case MusECore::Xml::Error:
                  case MusECore::Xml::End:
                        return;
                  case MusECore::Xml::TagStart:
                        if (tag == "topwin")
                              TopWin::readConfiguration(CLIPLIST, xml);
                        else
                              xml.unknown("ClipListEdit");
                        break;
                  case MusECore::Xml::TagEnd:
                        if (tag == "cliplistedit")
                              return;
                  default:
                        break;
                  }
            }
      }
Exemple #20
0
//---------------------------------------------------------
//   importPartToTrack
//---------------------------------------------------------
void MusE::importPartToTrack(QString& filename, unsigned tick, MusECore::Track* track)
{
      bool popenFlag = false;
      FILE* fp = MusEGui::fileOpen(this, filename, ".mpt", "r", popenFlag, false, false);

      if(fp) 
      {
        MusECore::Xml xml = MusECore::Xml(fp);
        bool firstPart = true;
        int posOffset = 0;
        int  notDone = 0;
        int  done = 0;
        
        bool end = false;
        MusEGlobal::song->startUndo();
        for (;;) 
        {
          MusECore::Xml::Token token = xml.parse();
          const QString& tag = xml.s1();
          switch (token) 
          {
            case MusECore::Xml::Error:
            case MusECore::Xml::End:
                  end = true;
                  break;
            case MusECore::Xml::TagStart:
                  if (tag == "part") {
                        // Read the part.
                        MusECore::Part* p = 0;
                        p = MusECore::Part::readFromXml(xml, track);
                        // If it could not be created...
                        if(!p)
                        {
                          // Increment the number of parts not done and break.
                          ++notDone;
                          break;
                        } 
                        
                        // Increment the number of parts done.
                        ++done;
                        
                        if(firstPart) 
                        {
                          firstPart=false;
                          posOffset = tick - p->tick();
                        }
                        p->setTick(p->tick() + posOffset);
                        MusEGlobal::audio->msgAddPart(p,false);
                        }
                  else
                        xml.unknown("MusE::importPartToTrack");
                  break;
            case MusECore::Xml::TagEnd:
                  break;
            default:
                  end = true;
                  break;
          }
          if(end)
            break;
        }
        fclose(fp);
        MusEGlobal::song->endUndo(SC_PART_INSERTED);
        
        if(notDone)
        {
          int tot = notDone + done;
          QMessageBox::critical(this, QString("MusE"),
            (tot > 1  ?  tr("%n part(s) out of %1 could not be imported.\nLikely the selected track is the wrong type.","",notDone).arg(tot)
                      :  tr("%n part(s) could not be imported.\nLikely the selected track is the wrong type.","",notDone)));
        }
        
        return;
      }
}
Exemple #21
0
void TopWin::readStatus(MusECore::Xml& xml)
{
	int x=0, y=0, width=800, height=600;
	
	for (;;)
	{
		MusECore::Xml::Token token = xml.parse();
		if (token == MusECore::Xml::Error || token == MusECore::Xml::End)
			break;
	
		QString tag = xml.s1();
		switch (token)
		{
			case MusECore::Xml::TagStart:
				if (tag == "x")
					x=xml.parseInt();
				else if (tag == "y")
					y=xml.parseInt();
				else if (tag == "width")
					width=xml.parseInt();
				else if (tag == "height")
					height=xml.parseInt();
				else if (tag == "toolbars")
				{
					if (!sharesToolsAndMenu())
					{
						if (!restoreState(QByteArray::fromHex(xml.parse1().toAscii())))
						{
							fprintf(stderr,"ERROR: couldn't restore toolbars. trying default configuration...\n");
							if (!restoreState(_toolbarNonsharedInit[_type]))
								fprintf(stderr,"ERROR: couldn't restore default toolbars. this is not really a problem.\n");
						}
					}
					else
					{
						_savedToolbarState=QByteArray::fromHex(xml.parse1().toAscii());
						if (_savedToolbarState.isEmpty())
							_savedToolbarState=_toolbarNonsharedInit[_type];
					}
				}
				else if (tag == "shares_menu")
				{
					shareToolsAndMenu(xml.parseInt());
				}
				else if (tag == "is_subwin")
				{
					setIsMdiWin(xml.parseInt());
				}
				else
					xml.unknown("TopWin");
				break;

			case MusECore::Xml::TagEnd:
				if (tag == "topwin")
				{
					if (mdisubwin)
					{
						if(mdisubwin->isMaximized())
							mdisubwin->showNormal();
						mdisubwin->move(x, y);
						mdisubwin->resize(width, height);
					}
					else
					{
						move(x,y);
						resize(width,height);
					}

					return;
				}
	
			default:
				break;
		}
	}
}