summaryrefslogtreecommitdiff
path: root/muse2/muse/dialogs.cpp
blob: 1dd19707e8ac68dd843443c9b839aa91547d267b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
//=========================================================
//  MusE
//  Linux Music Editor
//    $Id: functions.cpp,v 1.20.2.19 2011/05/05 20:10 flo93 Exp $
//  (C) Copyright 2011 Florian Jung (flo93@sourceforge.net)
//=========================================================

#include "dialogs.h"
#include "widgets/function_dialogs/velocity.h"
#include "widgets/function_dialogs/quantize.h"
#include "widgets/function_dialogs/crescendo.h"
#include "widgets/function_dialogs/gatetime.h"
#include "widgets/function_dialogs/remove.h"
#include "widgets/function_dialogs/transpose.h"
#include "widgets/function_dialogs/setlen.h"
#include "widgets/function_dialogs/move.h"
#include "widgets/function_dialogs/deloverlaps.h"
#include "widgets/function_dialogs/legato.h"
#include "widgets/pastedialog.h"

#include "xml.h"

#include <iostream>

using namespace std;

MusEDialog::GateTime* gatetime_dialog=NULL;
MusEDialog::Velocity* velocity_dialog=NULL;
MusEDialog::Quantize* quantize_dialog=NULL;
MusEDialog::Remove* erase_dialog=NULL;
MusEDialog::DelOverlaps* del_overlaps_dialog=NULL;
MusEDialog::Setlen* set_notelen_dialog=NULL;
MusEDialog::Move* move_notes_dialog=NULL;
MusEDialog::Transpose* transpose_dialog=NULL;
MusEDialog::Crescendo* crescendo_dialog=NULL;
MusEDialog::Legato* legato_dialog=NULL;
PasteDialog* paste_dialog=NULL; // FINDMICHJETZT

void init_function_dialogs(QWidget* parent)
{
	gatetime_dialog = new MusEDialog::GateTime(parent);
	velocity_dialog = new MusEDialog::Velocity(parent);
	quantize_dialog = new MusEDialog::Quantize(parent);
	erase_dialog = new MusEDialog::Remove(parent);
	del_overlaps_dialog = new MusEDialog::DelOverlaps(parent);
	set_notelen_dialog = new MusEDialog::Setlen(parent);
	move_notes_dialog = new MusEDialog::Move(parent);
	transpose_dialog = new MusEDialog::Transpose(parent);
	crescendo_dialog = new MusEDialog::Crescendo(parent);
	legato_dialog = new MusEDialog::Legato(parent);
	paste_dialog = new PasteDialog(parent); // FINDMICHJETZT
}

void read_function_dialog_config(Xml& xml)
{
	if (erase_dialog==NULL)
	{
		cout << "ERROR: THIS SHOULD NEVER HAPPEN: read_function_dialog_config() called, but\n"
		        "                                 dialogs are still uninitalized (NULL)!"<<endl;
		return;
	}
		
	for (;;)
	{
		Xml::Token token = xml.parse();
		if (token == Xml::Error || token == Xml::End)
			break;
			
		const QString& tag = xml.s1();
		switch (token)
		{
			case Xml::TagStart:
				if (tag == "mod_len")
					gatetime_dialog->read_configuration(xml);
				else if (tag == "mod_velo")
					velocity_dialog->read_configuration(xml);
				else if (tag == "quantize")
					quantize_dialog->read_configuration(xml);
				else if (tag == "erase")
					erase_dialog->read_configuration(xml);
				else if (tag == "del_overlaps")
					del_overlaps_dialog->read_configuration(xml);
				else if (tag == "setlen")
					set_notelen_dialog->read_configuration(xml);
				else if (tag == "move")
					move_notes_dialog->read_configuration(xml);
				else if (tag == "transpose")
					transpose_dialog->read_configuration(xml);
				else if (tag == "crescendo")
					crescendo_dialog->read_configuration(xml);
				else if (tag == "legato")
					legato_dialog->read_configuration(xml);
				else if (tag == "pastedialog")
					paste_dialog->read_configuration(xml);
				else
					xml.unknown("dialogs");
				break;
				
			case Xml::TagEnd:
				if (tag == "dialogs")
					return;
				
			default:
				break;
		}
	}
}

void write_function_dialog_config(int level, Xml& xml)
{
	xml.tag(level++, "dialogs");

	gatetime_dialog->write_configuration(level, xml);
	velocity_dialog->write_configuration(level, xml);
	quantize_dialog->write_configuration(level, xml);
	erase_dialog->write_configuration(level, xml);
	del_overlaps_dialog->write_configuration(level, xml);
	set_notelen_dialog->write_configuration(level, xml);
	move_notes_dialog->write_configuration(level, xml);
	transpose_dialog->write_configuration(level, xml);
	crescendo_dialog->write_configuration(level, xml);
	legato_dialog->write_configuration(level, xml);
	paste_dialog->write_configuration(level, xml);

	xml.tag(level, "/dialogs");
}