1 /*
2  *  tracker/DialogResample.h
3  *
4  *  Copyright 2009 Peter Barth
5  *
6  *  This file is part of Milkytracker.
7  *
8  *  Milkytracker is free software: you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation, either version 3 of the License, or
11  *  (at your option) any later version.
12  *
13  *  Milkytracker is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with Milkytracker.  If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 /*
24  *  DialogResample.h
25  *  MilkyTracker
26  *
27  *  Created by Peter Barth on 25.10.05.
28  *
29  */
30 
31 #ifndef __DIALOGRESAMPLE_H__
32 #define __DIALOGRESAMPLE_H__
33 
34 #include "DialogBase.h"
35 
36 class DialogResample : public PPDialogBase
37 {
38 private:
39 	class PPListBox* listBoxes[3];
40 	class PPCheckBox* checkBox;
41 	pp_int32 currentSelectedListBox;
42 	pp_int32 relnote, finetune;
43 	pp_uint32 size, finalSize;
44 	pp_uint32 count;
45 	float c4spd;
46 	float originalc4spd;
47 
48 	class ResamplerHelper* resamplerHelper;
49 	pp_int32 interpolationType;
50 	bool adjustFtAndRelnote;
51 
52 public:
53 	DialogResample(PPScreen* screen,
54 				   DialogResponder* responder,
55 				   pp_int32 id);
56 
57 	virtual ~DialogResample();
58 
59 	virtual void show(bool b = true);
60 
61 	virtual pp_int32 handleEvent(PPObject* sender, PPEvent* event);
62 
63 	void setRelNote(pp_int32 note);
64 	void setFineTune(pp_int32 ft);
65 	void setC4Speed(float c4spd);
66 	void setSize(pp_uint32 size);
67 
getC4Speed()68 	float getC4Speed() const { return c4spd; }
getRelNote()69 	pp_int32 getRelNote() const { return relnote; }
getFineTune()70 	pp_int32 getFineTune() const { return finetune; }
71 
setInterpolationType(pp_int32 interpolationType)72 	void setInterpolationType(pp_int32 interpolationType) { this->interpolationType = interpolationType; }
getInterpolationType()73 	pp_int32 getInterpolationType() const { return interpolationType; }
74 
setAdjustFtAndRelnote(bool adjustFtAndRelnote)75 	void setAdjustFtAndRelnote(bool adjustFtAndRelnote) { this->adjustFtAndRelnote = adjustFtAndRelnote; }
getAdjustFtAndRelnote()76 	bool getAdjustFtAndRelnote() const { return adjustFtAndRelnote; }
77 
78 private:
79 	void listBoxEnterEditState(pp_int32 id);
80 
81 	void updateListBoxes();
82 	void updateListBox(pp_int32 id, float val, pp_int32 numDecimals);
83 
84 	void commitChanges();
85 
86 	void switchListBox();
87 
88 	void toC4Speed();
89 	void fromC4Speed();
90 
91 	void calcSize();
92 
93 	void validate();
94 };
95 
96 #endif
97 
98