1 // Copyright 2004 "Gilles Degottex"
3 // This file is part of "fmit"
5 // "fmit" is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
10 // "fmit" is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include "GLErrorHistory.h"
21 static const unsigned char g_icon_error_graph[] = {
22 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
23 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20,
24 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, 0xf4, 0x00, 0x00, 0x06,
25 0xa7, 0x49, 0x44, 0x41, 0x54, 0x78, 0x9c, 0xad, 0x96, 0x6b, 0x6c, 0x14,
26 0xe7, 0x15, 0x86, 0x9f, 0x99, 0xd9, 0x9d, 0xdd, 0xf1, 0xda, 0x2c, 0xbe,
27 0xc6, 0x18, 0x63, 0x9b, 0xa4, 0x4d, 0x7c, 0x81, 0x60, 0x70, 0x1a, 0x1b,
28 0x5a, 0xe3, 0xc4, 0x24, 0xa4, 0xa2, 0x11, 0x25, 0x40, 0x12, 0x88, 0x94,
29 0x0b, 0xa9, 0x22, 0x15, 0xa5, 0x37, 0x45, 0x95, 0xaa, 0x26, 0x52, 0x2a,
30 0x35, 0x45, 0x55, 0xd3, 0x4a, 0xa1, 0x6d, 0x54, 0x1a, 0xa9, 0x09, 0x71,
31 0x83, 0x52, 0xe4, 0x34, 0x8d, 0x9a, 0x90, 0xd0, 0x48, 0x34, 0xa9, 0xb9,
32 0x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, 0x93, 0xe1, 0xe1, 0xcb, 0x78, 0x2e, 0x9e,
92 0x07, 0x40, 0x10, 0xa0, 0xe4, 0x96, 0x3c, 0xf2, 0xdd, 0x4e, 0x56, 0x35,
93 0xad, 0xc1, 0x3a, 0x77, 0x01, 0x33, 0x99, 0xc4, 0x28, 0x2f, 0xc7, 0x77,
94 0xba, 0x27, 0x63, 0x9e, 0x91, 0x30, 0xfd, 0xcc, 0x4f, 0x05, 0x58, 0xa6,
95 0x2c, 0x2c, 0x97, 0x45, 0x59, 0xc6, 0x3c, 0xdf, 0xc7, 0x82, 0x85, 0xb7,
96 0xf0, 0xca, 0xce, 0x97, 0x09, 0x87, 0xe2, 0x24, 0x93, 0x06, 0x00, 0xf1,
97 0xb8, 0x86, 0xaa, 0x8e, 0xb5, 0xb3, 0x53, 0xb1, 0x53, 0x54, 0xe2, 0x42,
98 0x71, 0xda, 0xc8, 0xcd, 0x93, 0x59, 0xd7, 0xfc, 0x30, 0x91, 0x23, 0x9d,
99 0xd8, 0x0b, 0x0b, 0x11, 0xe7, 0xcf, 0x9f, 0x6c, 0x7e, 0x1d, 0x4d, 0x05,
100 0x50, 0x44, 0xe7, 0x58, 0x85, 0x72, 0x45, 0x99, 0x25, 0xb5, 0xb7, 0x53,
101 0x5f, 0x5f, 0x4f, 0x28, 0xa8, 0x65, 0x16, 0x24, 0x12, 0xf1, 0x0c, 0x40,
102 0x5c, 0x4b, 0xe1, 0x39, 0xef, 0x47, 0x92, 0x44, 0x72, 0x5d, 0x32, 0xf5,
103 0x4b, 0x57, 0x62, 0xf6, 0xff, 0x17, 0x80, 0x9c, 0xca, 0xca, 0x39, 0xcd,
104 0x67, 0x02, 0xc8, 0x28, 0x6d, 0x99, 0xe4, 0xe5, 0xb9, 0x59, 0xbf, 0x7e,
105 0x3d, 0xb1, 0xa8, 0x3e, 0x19, 0x20, 0x3a, 0x6d, 0xa0, 0x61, 0xb3, 0x09,
106 0x28, 0x2e, 0x17, 0x42, 0x72, 0xec, 0xa9, 0x45, 0x69, 0xb6, 0x19, 0x97,
107 0x05, 0x80, 0x6e, 0xa5, 0xd1, 0xb4, 0x24, 0xa9, 0x94, 0x81, 0x65, 0x5d,
108 0x8d, 0xcb, 0x0e, 0x07, 0x47, 0x8f, 0x1d, 0xe2, 0x44, 0xf7, 0xb1, 0x49,
109 0xeb, 0xaf, 0x5c, 0x19, 0xa0, 0xa7, 0xa7, 0x13, 0x9b, 0x38, 0x66, 0x6c,
110 0x61, 0x91, 0x8d, 0x66, 0x6a, 0x43, 0x00, 0xd2, 0x36, 0x89, 0xe1, 0xe1,
111 0x20, 0x91, 0xd1, 0xa2, 0x49, 0xf1, 0x75, 0xdf, 0x7c, 0x88, 0xbb, 0x56,
112 0x34, 0xb1, 0xef, 0xa3, 0xbf, 0xf1, 0xf7, 0x0f, 0xda, 0x69, 0x59, 0x7d,
113 0x3f, 0xf7, 0xac, 0x5e, 0x4b, 0x34, 0x16, 0x65, 0x68, 0x68, 0x80, 0xb4,
114 0x31, 0xfe, 0xde, 0xb3, 0xf3, 0xbf, 0x3e, 0x80, 0xdc, 0xd8, 0xc0, 0x5f,
115 0xda, 0xdb, 0xa8, 0xac, 0xfc, 0xf1, 0xb4, 0x7b, 0x25, 0x25, 0x0b, 0x78,
116 0xfa, 0xa9, 0x67, 0x01, 0xe8, 0x39, 0x7d, 0x82, 0xbd, 0xed, 0xbb, 0x51,
117 0x72, 0x0a, 0xa9, 0xaa, 0x5c, 0x8a, 0x18, 0xe8, 0x1d, 0x07, 0xc8, 0x8e,
118 0xe0, 0xba, 0xaf, 0x20, 0xb7, 0xb6, 0x86, 0xce, 0xb3, 0x9f, 0x31, 0xe2,
119 0x0b, 0xcf, 0x9a, 0x60, 0x49, 0xdd, 0x72, 0x36, 0x6f, 0x7c, 0x92, 0xba,
120 0xda, 0x55, 0x1c, 0x39, 0xf6, 0x31, 0xf6, 0x65, 0x75, 0x59, 0x19, 0xcf,
121 0x09, 0x00, 0x60, 0xfb, 0x46, 0x23, 0x3b, 0xff, 0xf0, 0x0a, 0x09, 0xfd,
122 0x6a, 0x3b, 0xf9, 0x46, 0x86, 0x09, 0x06, 0xfd, 0x99, 0x6b, 0xcb, 0xb4,
123 0x08, 0x8c, 0xc6, 0xf1, 0x0e, 0x07, 0x38, 0x3d, 0xf8, 0x1f, 0x94, 0xf1,
124 0xd3, 0x6f, 0xdd, 0x6c, 0x05, 0x00, 0x72, 0x97, 0xd4, 0x71, 0xc6, 0xa5,
125 0xf3, 0xcb, 0xdf, 0xec, 0x40, 0xd3, 0x92, 0x58, 0x16, 0xec, 0xfb, 0xf0,
126 0x5d, 0xfe, 0xf9, 0xe9, 0x7e, 0x00, 0x52, 0x29, 0x83, 0x40, 0x48, 0xc3,
127 0x3b, 0x1c, 0xe6, 0x77, 0x6f, 0xbc, 0x88, 0xfb, 0x91, 0x87, 0x10, 0x66,
128 0x18, 0x36, 0xb3, 0x3e, 0xe4, 0x5c, 0x0b, 0xf2, 0x5a, 0x9a, 0x39, 0xdd,
129 0x75, 0x94, 0x1f, 0xfe, 0xf4, 0x7b, 0x6c, 0xd9, 0xb0, 0x8d, 0xd6, 0xd6,
130 0x8d, 0x88, 0xa2, 0x88, 0x2f, 0x10, 0x23, 0x12, 0xd1, 0xe9, 0x3e, 0xf1,
131 0x6f, 0xde, 0xde, 0xb7, 0x0b, 0xdb, 0xea, 0x26, 0x9c, 0x65, 0x65, 0x57,
132 0x37, 0x66, 0x59, 0x81, 0xa9, 0x00, 0x96, 0xee, 0xf5, 0xa2, 0x9e, 0x3b,
133 0x4b, 0x5e, 0x75, 0x4d, 0x26, 0x98, 0xbb, 0xb2, 0x91, 0xd8, 0x1d, 0x41,
134 0x7e, 0xff, 0xe9, 0x5b, 0x88, 0x7b, 0xbc, 0x28, 0x0e, 0x17, 0xa6, 0x65,
135 0x92, 0x36, 0xd3, 0xe8, 0xc5, 0xf3, 0x99, 0xf7, 0xd4, 0x16, 0x6c, 0x2e,
136 0xd7, 0xe4, 0x44, 0x59, 0xb6, 0xc1, 0xd4, 0x7a, 0x09, 0xc0, 0x26, 0xe0,
137 0xa5, 0xdc, 0x3b, 0xaa, 0xab, 0x4b, 0x37, 0x6c, 0xc0, 0xb5, 0x78, 0xf1,
138 0xe4, 0xc4, 0xa6, 0x89, 0x65, 0x18, 0x88, 0x76, 0xfb, 0xac, 0x89, 0x63,
139 0x7e, 0x3f, 0xa3, 0x03, 0xfd, 0x93, 0x62, 0x81, 0xb6, 0x36, 0x2c, 0x5d,
140 0x57, 0x80, 0xc4, 0x44, 0x6c, 0xa6, 0x71, 0x75, 0x06, 0xf8, 0x63, 0x32,
141 0xe0, 0xbf, 0x14, 0x3c, 0x72, 0x78, 0x79, 0x7c, 0x70, 0xd0, 0xed, 0x2c,
142 0x2b, 0xc3, 0x3e, 0x6f, 0xde, 0x18, 0xa1, 0x20, 0x20, 0x64, 0x31, 0xe5,
143 0x52, 0x5a, 0x8c, 0x44, 0x78, 0x72, 0x07, 0xc5, 0x4f, 0x9e, 0x04, 0xc3,
144 0xd8, 0x01, 0x64, 0x4e, 0xf5, 0xf5, 0x32, 0x59, 0x40, 0x37, 0xb0, 0x4b,
145 0xf7, 0x7a, 0x47, 0x02, 0x87, 0x0e, 0x36, 0xe8, 0x3e, 0x9f, 0x4b, 0x29,
146 0x2f, 0x9f, 0x56, 0xea, 0xeb, 0x29, 0x19, 0xd3, 0xd0, 0x23, 0x57, 0x01,
147 0x04, 0x49, 0x22, 0x76, 0xfc, 0xb8, 0x85, 0x65, 0xbd, 0x04, 0x18, 0x73,
148 0x01, 0x4c, 0xc8, 0x00, 0x8e, 0x02, 0xbb, 0x12, 0x97, 0x2f, 0x6b, 0xfe,
149 0x83, 0x1d, 0x0d, 0xe9, 0x70, 0xd8, 0xa9, 0x2c, 0x5a, 0x84, 0xe4, 0x74,
150 0xce, 0x0e, 0xa0, 0xc5, 0xd0, 0x23, 0xe3, 0xdf, 0x0c, 0x41, 0x20, 0xd1,
151 0xd5, 0x45, 0x72, 0x68, 0xe8, 0x05, 0xa0, 0xe3, 0xda, 0x75, 0xd9, 0x7d,
152 0x31, 0xc6, 0x7e, 0x24, 0x0f, 0x61, 0x59, 0xaf, 0xc5, 0xfb, 0xfb, 0xf1,
153 0x77, 0x74, 0xac, 0x30, 0xe2, 0x71, 0xbb, 0x52, 0x59, 0x89, 0x28, 0xcb,
154 0x33, 0x03, 0xc4, 0xae, 0x02, 0x18, 0x7d, 0x17, 0x89, 0x74, 0x75, 0xb6,
155 0x01, 0xd3, 0xc6, 0x6a, 0xb6, 0x00, 0x13, 0x4a, 0x00, 0x07, 0x30, 0xcd,
156 0xdd, 0x5a, 0x9f, 0x47, 0x09, 0x1c, 0xec, 0xa8, 0xb7, 0x0c, 0x53, 0x52,
157 0x2a, 0x2a, 0x10, 0x6d, 0x93, 0x1b, 0x2a, 0x19, 0x8d, 0xa2, 0xab, 0x11,
158 0x84, 0x70, 0x84, 0xc0, 0x07, 0xef, 0x1f, 0x04, 0x1e, 0xe1, 0x9a, 0xd2,
159 0xdf, 0x28, 0xc0, 0x84, 0xa2, 0xc0, 0x47, 0x56, 0x3a, 0xbd, 0x27, 0x76,
160 0xbe, 0xb7, 0x20, 0x70, 0xf8, 0xf0, 0x52, 0x41, 0x94, 0x04, 0x65, 0xd1,
161 0xa2, 0xcc, 0x01, 0xd5, 0x63, 0x51, 0xd2, 0xe1, 0x30, 0xbe, 0xb7, 0xfe,
162 0xec, 0x01, 0xee, 0x1f, 0xdf, 0x33, 0x4d, 0x37, 0x0a, 0x30, 0xa1, 0x51,
163 0xe0, 0x3d, 0x2b, 0x99, 0x7c, 0x57, 0x3d, 0x73, 0xa6, 0x2c, 0xf4, 0x59,
164 0x57, 0xb5, 0xe8, 0x74, 0x22, 0x17, 0x14, 0x10, 0x1f, 0x1c, 0x60, 0xe8,
165 0xcd, 0x37, 0x47, 0x31, 0x8c, 0x56, 0x60, 0xf0, 0x26, 0x7d, 0xb2, 0xd6,
166 0xdd, 0xc0, 0x81, 0x71, 0xb0, 0x6e, 0xa0, 0x75, 0xae, 0x0d, 0xff, 0x03,
167 0xed, 0xb9, 0xfb, 0x1d, 0x80, 0xeb, 0x9a, 0x91, 0x00, 0x00, 0x00, 0x00,
168 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
176 #include <qtooltip.h>
178 #include <Music/Music.h>
180 void GLErrorHistory::Note::init()
182 min_err = numeric_limits<float>::max();
183 max_err = -numeric_limits<float>::max();
186 GLErrorHistory::Note::Note(int h)
191 GLErrorHistory::Note::Note(int h, int num, int den)
195 factor = QString::number(num)+"/"+QString::number(den);
197 GLErrorHistory::Note::Note(int h, float cents)
201 factor = QString::number(cents);
203 QString GLErrorHistory::Note::getName() const
205 return Music::h2n(ht)+factor;
207 void GLErrorHistory::Note::addError(float err)
209 min_err = (err<min_err)?err:min_err;
210 max_err = (err>max_err)?err:max_err;
213 avg_err *= errors.size();
215 errors.push_back(err);
218 avg_err /= errors.size();
221 GLErrorHistory::GLErrorHistory(QWidget* parent)
222 : QGLWidget(parent, "GLErrorHistory")
223 , View("Error history", this)
227 img.loadFromData(g_icon_error_graph, sizeof(g_icon_error_graph), "PNG");
228 setting_show->setIconSet(QIconSet(QImage(img)));
229 setting_show->setOn(true);
231 setting_keep = new QAction(this);
232 setting_keep->setMenuText(tr("Keep previous notes"));
233 setting_keep->setToggleAction(true);
234 setting_keep->setOn(false);
235 connect(setting_keep, SIGNAL(toggled(bool)), this, SLOT(keepPreviousNotes(bool)));
236 // setting_keep->addTo(&m_popup_menu);
238 ui_notesNameMenu = new QPopupMenu(this);
239 ui_notesNameMenu->insertItem(tr("Anglo-saxon"), Music::LOCAL_ANGLO);
240 ui_notesNameMenu->connectItem(int(Music::LOCAL_ANGLO), this, SLOT(selectNotesNames(int)));
241 ui_notesNameMenu->insertItem(tr("Latin"), Music::LOCAL_LATIN);
242 ui_notesNameMenu->connectItem(int(Music::LOCAL_LATIN), this, SLOT(selectNotesNames(int)));
243 ui_notesNameMenu->setCheckable(true);
244 ui_notesNameMenu->setItemChecked(int(Music::GetNotesName()), true);
245 // m_popup_menu.insertItem("Notes names", ui_notesNameMenu);
247 setting_useCents = new QAction(this);
248 setting_useCents->setMenuText(tr("Use cents"));
249 setting_useCents->setToggleAction(true);
250 setting_useCents->setOn(true);
251 connect(setting_useCents, SIGNAL(toggled(bool)), this, SLOT(update()));
252 setting_useCents->addTo(&m_popup_menu);
254 m_popup_menu.insertItem(new Title(tr("Scale range"), &m_popup_menu));
255 setting_spinScale = new QSpinBox(5, 50, 1, &m_popup_menu);
256 setting_spinScale->setValue(50);
257 QToolTip::add(setting_spinScale, tr("Scale range (in cents)"));
258 connect(setting_spinScale, SIGNAL(valueChanged(int)), this, SLOT(update()));
259 m_popup_menu.insertItem(setting_spinScale);
262 void GLErrorHistory::save()
264 s_settings->writeEntry("keep", setting_keep->isOn());
265 // s_settings->writeEntry("notesNames", int(Music::GetNotesName()));
266 s_settings->writeEntry("useCents", setting_useCents->isOn());
267 s_settings->writeEntry("spinScale", setting_spinScale->value());
269 void GLErrorHistory::load()
271 setting_keep->setOn(s_settings->readBoolEntry("keep", setting_keep->isOn()));
272 // selectNotesNames(s_settings->readNumEntry("notesNames", int(Music::GetNotesName())));
273 setting_useCents->setOn(s_settings->readBoolEntry("useCents", setting_useCents->isOn()));
274 setting_spinScale->setValue(s_settings->readNumEntry("spinScale", setting_spinScale->value()));
276 void GLErrorHistory::clearSettings()
278 // cerr << "GLErrorHistory::clearSettings" << endl;
279 s_settings->removeEntry("keep");
280 s_settings->removeEntry("notesNames");
281 s_settings->removeEntry("useCents");
282 s_settings->removeEntry("spinScale");
285 void GLErrorHistory::addNote(GLErrorHistory::Note note)
287 m_notes.push_back(note);
289 if(!setting_keep->isOn())
290 while(m_notes.size()>1)
293 void GLErrorHistory::addError(float err)
295 m_notes.back().addError(err);
298 void GLErrorHistory::keepPreviousNotes(bool keep)
301 while(m_notes.size()>1)
305 void GLErrorHistory::selectNotesNames(int id)
307 for(int i=0; i<int(ui_notesNameMenu->count()); i++)
308 ui_notesNameMenu->setItemChecked(ui_notesNameMenu->idAt(i), id==ui_notesNameMenu->idAt(i));
310 Music::SetNotesName((Music::NotesName)id);
315 void GLErrorHistory::initializeGL()
317 // Set the clear color to black
318 glClearColor(1.0, 1.0, 1.0, 0.0);
320 // glShadeModel( GL_FLAT );
321 glShadeModel( GL_SMOOTH );
326 void GLErrorHistory::drawTicksCent(int r, int ticks_size)
328 // only work within range that is a pure multiple of r
329 float range = int(setting_spinScale->value()/r)*r;
331 float scale = 50.0f/setting_spinScale->value();
332 if((height()-ticks_size)*r/100.0f*scale>2)
334 for(float i=-range; i<=range; i+=r)
336 int y = int(height()*i/100.0f*scale) + height()/2;
337 glVertex2i(ticks_size, y);
338 glVertex2i(width(), y);
342 void GLErrorHistory::drawTextTickCent(int r, int dy)
344 // only work within range that is a pure multiple of r
345 int range = int(setting_spinScale->value()/r)*r;
347 float scale = 50.0f/setting_spinScale->value();
349 for(int i=-range; i<range; i+=r)
351 txt = QString::number(i);
352 if(i>=0) txt = QString(" ")+txt;
353 if(i==0) txt = QString(" ")+txt;
354 glRasterPos2i(2, int(height()*i/100.0f*scale) + height()/2 - dy);
355 for(size_t i=0; i<txt.length(); i++)
356 glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, txt.latin1()[i]);
360 void GLErrorHistory::paintGL()
362 // cerr << "GLErrorHistory::paintGL " << m_notes.size() << endl;
364 glClear(GL_COLOR_BUFFER_BIT);
369 QString str = tr("Error");
370 glColor3f(0.75,0.75,0.75);
371 glRasterPos2i(2, height()-20);
372 for(size_t i = 0; i < str.length(); i++)
373 glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, str.latin1()[i]);
376 int ticks_size = 2+3*char_size;
377 int dy = char_size/2;
380 if(setting_useCents->isOn())
384 // glColor3f(gray, gray, gray);
385 // drawTicksCent(1, ticks_size);
387 glColor3f(gray, gray, gray);
388 drawTicksCent(2, ticks_size);
390 glColor3f(gray, gray, gray);
391 drawTicksCent(10, ticks_size);
398 glColor3f(gray, gray, gray);
399 glVertex2i(ticks_size, height()/2);
400 glVertex2i(width(), height()/2);
402 glColor3f(gray, gray, gray);
403 glVertex2i(ticks_size, height()/4);
404 glVertex2i(width(), height()/4);
405 glVertex2i(ticks_size, 3*height()/4);
406 glVertex2i(width(), 3*height()/4);
408 glColor3f(gray, gray, gray);
409 glVertex2i(ticks_size, height()/8);
410 glVertex2i(width(), height()/8);
411 glVertex2i(ticks_size, 7*height()/8);
412 glVertex2i(width(), 7*height()/8);
413 glVertex2i(ticks_size, 3*height()/8);
414 glVertex2i(width(), 3*height()/8);
415 glVertex2i(ticks_size, 5*height()/8);
416 glVertex2i(width(), 5*height()/8);
422 glColor3f(gray, gray, gray);
423 if(setting_useCents->isOn())
426 if(setting_spinScale->value() <= 25) grad=5;
427 if(setting_spinScale->value() <= 10) grad=1;
428 drawTextTickCent(grad, dy);
432 string sfraq, sufraq;
433 sufraq = string("1/")+QString::number(int(50/setting_spinScale->value())*2).latin1();
434 sfraq = string("+")+sufraq;
435 glRasterPos2i(2, 3*height()/4-dy);
436 for(size_t i = 0; i < sfraq.size(); i++)
437 glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, sfraq[i]);
438 sfraq = string("-")+sufraq;
439 glRasterPos2i(2, height()/4-dy);
440 for(size_t i = 0; i < sfraq.size(); i++)
441 glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, sfraq[i]);
443 sufraq = string("1/")+QString::number(int(50/setting_spinScale->value())*4).latin1();
444 sfraq = string("+")+sufraq;
445 glRasterPos2i(2, 5*height()/8-dy);
446 for(size_t i = 0; i < sfraq.size(); i++)
447 glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, sfraq[i]);
448 sfraq = string("-")+sufraq;
449 glRasterPos2i(2, 3*height()/8-dy);
450 for(size_t i = 0; i < sfraq.size(); i++)
451 glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, sfraq[i]);
458 for(size_t i=0; i<m_notes.size(); i++)
459 total_size += m_notes[i].errors.size()-1;
461 float step = float(width()-ticks_size)/total_size;
463 // cerr << "total_size=" << total_size << " step=" << step << endl;
466 for(size_t i=0; i<m_notes.size(); i++)
468 float x = ticks_size+step*curr_total;
470 // if it's not the first, add a separation
473 glColor3f(0.75,0.75,0.75);
476 glVertex2f(x, 0); glVertex2f(x, height());
481 string str = m_notes[i].getName();
482 glColor3f(0.0,0.0,1.0);
483 glRasterPos2f(x+2, 2);
484 for(size_t c=0; c<str.length(); c++)
485 glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, str[c]);
487 // draw the error graph
488 glColor3f(0.0f,0.0f,0.0f);
490 glBegin(GL_LINE_STRIP);
492 if(setting_useCents->isOn())
494 float scale = 50.0f/setting_spinScale->value();
495 glVertex2f(x, int(scale*m_notes[i].errors[0]*height()) + height()/2);
496 for(int j=1; j<int(m_notes[i].errors.size()); j++)
497 glVertex2f(x+j*step, scale*m_notes[i].errors[j]*height() + height()/2);
501 float scale = int(50/setting_spinScale->value());
502 glVertex2f(x, int((scale*m_notes[i].errors[0])*height()) + height()/2);
503 for(int j=1; j<int(m_notes[i].errors.size()); j++)
504 glVertex2f(x+j*step, (scale*m_notes[i].errors[j])*height() + height()/2);
508 curr_total += m_notes[i].errors.size()-1;
515 void GLErrorHistory::resizeGL( int w, int h )
517 // Set the new viewport size
518 glViewport(0, 0, (GLint)w, (GLint)h);
520 // Choose the projection matrix to be the matrix
521 // manipulated by the following calls
522 glMatrixMode(GL_PROJECTION);
524 // Set the projection matrix to be the identity matrix
527 // Define the dimensions of the Orthographic Viewing Volume
528 glOrtho(0.0, w, 0.0, h, 0.0, 1.0);
530 // Choose the modelview matrix to be the matrix
531 // manipulated by further calls
532 glMatrixMode(GL_MODELVIEW);