1 /*
2 * tracker/TrackerInit.cpp
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 #include "Tracker.h"
24 #include "TrackerConfig.h"
25 #include "TabManager.h"
26 #include "PlayerController.h"
27 #include "ModuleEditor.h"
28 #include "PatternTools.h"
29 #include "Tools.h"
30
31 #include "PPUIConfig.h"
32 #include "ListBox.h"
33 #include "StaticText.h"
34 #include "Seperator.h"
35 #include "MessageBoxContainer.h"
36 #include "PatternEditorControl.h"
37 #include "TransparentContainer.h"
38 #include "PianoControl.h"
39 #include "PeakLevelControl.h"
40 #include "ScopesControl.h"
41 #include "TabHeaderControl.h"
42 #include "TitlePageManager.h"
43
44 // Sections
45 #include "SectionSwitcher.h"
46 #include "SectionTranspose.h"
47 #include "SectionAdvancedEdit.h"
48 #include "SectionDiskMenu.h"
49 #include "SectionHDRecorder.h"
50 #include "SectionSettings.h"
51 #include "SectionInstruments.h"
52 #include "SectionSamples.h"
53 #include "SectionQuickOptions.h"
54 #include "SectionOptimize.h"
55 #include "SectionAbout.h"
56
57 #include "InputControlListener.h"
58
59 #include "ControlIDs.h"
60 #include "SIPButtons.h"
61
initUI()62 void Tracker::initUI()
63 {
64 pp_int32 c;
65 PPButton* button = NULL;
66
67 // ---------- initialise sections --------
68 for (pp_int32 i = 0; i < sections->size(); i++)
69 sections->get(i)->init();
70
71 #ifdef __LOWRES__
72 pp_int32 height2 = screen->getHeight()-UPPERSECTIONDEFAULTHEIGHT();
73
74 PPContainer* containerAbout = new PPContainer(CONTAINER_ABOUT, screen, this, PPPoint(116-2, height2), PPSize((306-116+2)+14,24), false);
75 containerAbout->setColor(TrackerConfig::colorThemeMain);
76
77 // Song title edit field
78 PPListBox* listBox = new PPListBox(LISTBOX_SONGTITLE, screen, this, PPPoint(116-2+2, height2+2+8), PPSize(200+2,12), true, true, false);
79 listBox->showSelection(false);
80 listBox->setSingleButtonClickEdit(true);
81 listBox->setBorderColor(TrackerConfig::colorThemeMain);
82
83 char str[MP_MAXTEXT+1];
84 moduleEditor->getTitle(str, ModuleEditor::MAX_TITLETEXT);
85
86 listBox->addItem(str);
87 listBox->setMaxEditSize(ModuleEditor::MAX_TITLETEXT);
88
89 containerAbout->addControl(listBox);
90
91 PPStaticText* staticText = playTimeText = new PPStaticText(STATICTEXT_ABOUT_TIME, screen, this, PPPoint(116+2, height2+2+8+3), "", false);
92 containerAbout->addControl(staticText);
93
94 button = new PPButton(BUTTON_ABOUT_ESTIMATESONGLENGTH, screen, this, PPPoint(containerAbout->getLocation().x + containerAbout->getSize().width - 6*8-4, height2+2+8+2), PPSize(6*8, 9));
95 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
96 button->setText("Estimate");
97 containerAbout->addControl(button);
98
99 peakLevelControl = new PeakLevelControl(PEAKLEVEL_CONTROL, screen, this, PPPoint(116-2+2, height2+10), PPSize(200+2,12));
100 peakLevelControl->setBorderColor(TrackerConfig::colorThemeMain);
101 peakLevelControl->hide(true);
102 containerAbout->addControl(peakLevelControl);
103
104 // switch to Peak level
105 pp_int32 aboutButtonOffset = -33 - 30 - 30 - 23*3 - 14;
106
107 button = new PPButton(BUTTON_ABOUT_SHOWTITLE, screen, this, PPPoint(containerAbout->getLocation().x + containerAbout->getSize().width + aboutButtonOffset, height2+1), PPSize(29, 9), false, true, false);
108 button->setColor(TrackerConfig::colorThemeMain);
109 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
110 button->setText("Title");
111 button->setTextColor(PPUIConfig::getInstance()->getColor(PPUIConfig::ColorStaticText));
112 containerAbout->addControl(button);
113
114 button = new PPButton(BUTTON_ABOUT_SHOWTIME, screen, this, PPPoint(containerAbout->getLocation().x + containerAbout->getSize().width + aboutButtonOffset + 29, height2+1), PPSize(24, 9), false, true, false);
115 button->setColor(TrackerConfig::colorThemeMain);
116 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
117 button->setText("Time");
118 button->setTextColor(PPUIConfig::getInstance()->getColor(PPUIConfig::ColorStaticText));
119 containerAbout->addControl(button);
120
121 button = new PPButton(BUTTON_ABOUT_SHOWPEAK, screen, this, PPPoint(containerAbout->getLocation().x + containerAbout->getSize().width + aboutButtonOffset + 29+24, height2+1), PPSize(24, 9), false, true, false);
122 button->setColor(TrackerConfig::colorThemeMain);
123 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
124 button->setText("Peak");
125 button->setTextColor(PPUIConfig::getInstance()->getColor(PPUIConfig::ColorStaticText));
126 containerAbout->addControl(button);
127
128 button = new PPButton(MAINMENU_PLAY_SONG, screen, this, PPPoint(containerAbout->getLocation().x + containerAbout->getSize().width + aboutButtonOffset + (29+24+24) + 2, height2+1), PPSize(23, 9), false);
129 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
130 button->setText("Play");
131 containerAbout->addControl(button);
132
133 button = new PPButton(MAINMENU_PLAY_PATTERN, screen, this, PPPoint(containerAbout->getLocation().x + containerAbout->getSize().width + aboutButtonOffset + (29+24+24) + 2 + 23, height2+1), PPSize(23, 9), false);
134 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
135 button->setText("Pat");
136 containerAbout->addControl(button);
137
138 button = new PPButton(MAINMENU_STOP, screen, this, PPPoint(containerAbout->getLocation().x + containerAbout->getSize().width + aboutButtonOffset + (29+24+24) + 2 + 23*2, height2+1), PPSize(23, 9), false);
139 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
140 button->setText("Stop");
141 containerAbout->addControl(button);
142
143 button = new PPButton(BUTTON_ABOUT_FOLLOWSONG, screen, this, PPPoint(containerAbout->getLocation().x + containerAbout->getSize().width + aboutButtonOffset + (29+24+24) + 2 + 23*3, height2+1), PPSize(12, 9), false, true, false);
144 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
145 button->setText("F");
146 containerAbout->addControl(button);
147
148 button = new PPButton(BUTTON_ABOUT_LIVESWITCH, screen, this, PPPoint(containerAbout->getLocation().x + containerAbout->getSize().width + aboutButtonOffset + (29+24+24) + 2 + 23*3 + 12, height2+1), PPSize(12, 9), false, true, false);
149 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
150 button->setText("L");
151 containerAbout->addControl(button);
152
153 staticText = new PPStaticText(STATICTEXT_ABOUT_HEADING, screen, this, PPPoint(116, height2+3), "Title:", true);
154 staticText->setFont(PPFont::getFont(PPFont::FONT_TINY));
155 containerAbout->addControl(staticText);
156
157 screen->addControl(containerAbout);
158
159 // small sections
160 initSectionOrderlist(0,0+height2);
161
162 initSectionSpeed(116-2,24+height2);
163
164 initSectionPattern(116-4+99,24+height2);
165
166 // Main options
167 initSectionMainOptions(0, 0+height2);
168 initListboxesSection(0, 0+height2);
169
170 // add scopes (hidden by default)
171 scopesControl = new ScopesControl(SCOPES_CONTROL, screen, this,
172 PPPoint(0, 0 + height2),
173 PPSize(SCOPESWIDTH(), SCOPESHEIGHT()));
174 scopesControl->setBorderColor(TrackerConfig::colorThemeMain);
175 scopesControl->show(false);
176 screen->addControl(scopesControl);
177
178 // add sub menu selection buttons (pages)
179 {
180 PPButton* button;
181
182 PPContainer* container = new PPContainer(CONTAINER_SCOPECONTROL, screen, this, PPPoint(scopesControl->getSize().width, 0 + height2), PPSize(screen->getWidth()-scopesControl->getSize().width,SCOPESHEIGHT()), false);
183 container->setColor(TrackerConfig::colorThemeMain);
184
185 pp_int32 dy = (container->getSize().height-2) / 5;
186 button = new PPButton(BUTTON_SCOPECONTROL_MUTE, screen, this, PPPoint(container->getLocation().x + 1, container->getLocation().y + 2), PPSize(container->getSize().width-3, dy), false, true, false);
187 button->setText("Mute");
188 button->setColor(TrackerConfig::colorThemeMain);
189 button->setTextColor(PPUIConfig::getInstance()->getColor(PPUIConfig::ColorStaticText));
190 container->addControl(button);
191
192 button = new PPButton(BUTTON_SCOPECONTROL_SOLO, screen, this, PPPoint(container->getLocation().x + 1, container->getLocation().y + 2 + dy), PPSize(container->getSize().width-3, dy), false, true, false);
193 button->setText("Solo");
194 button->setColor(TrackerConfig::colorThemeMain);
195 button->setTextColor(PPUIConfig::getInstance()->getColor(PPUIConfig::ColorStaticText));
196 container->addControl(button);
197
198 button = new PPButton(BUTTON_SCOPECONTROL_REC, screen, this, PPPoint(container->getLocation().x + 1, container->getLocation().y + 2 + dy*2), PPSize(container->getSize().width-3, dy), false, true, false);
199 button->setText("Rec.");
200 button->setColor(TrackerConfig::colorThemeMain);
201 button->setTextColor(PPUIConfig::getInstance()->getColor(PPUIConfig::ColorStaticText));
202 container->addControl(button);
203
204 button = new PPButton(MAINMENU_PLAY_SONG, screen, this, PPPoint(container->getLocation().x + 1, container->getLocation().y + 2 + dy*3), PPSize(container->getSize().width-3, dy), false);
205 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
206 button->setText("Play");
207 container->addControl(button);
208
209 button = new PPButton(MAINMENU_STOP, screen, this, PPPoint(container->getLocation().x + 1, container->getLocation().y + 2 + dy*4), PPSize(container->getSize().width-3, dy), false);
210 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
211 button->setText("Stop");
212 container->addControl(button);
213
214 container->show(false);
215 screen->addControl(container);
216
217 pp_int32 y = height2 + 64;
218
219 container = new PPContainer(CONTAINER_LOWRES_MENUSWITCH, screen, this, PPPoint(0, y), PPSize(screen->getWidth(),16), false);
220 container->setColor(TrackerConfig::colorThemeMain);
221
222 const pp_int32 numSubMenus = NUMSUBMENUS();
223
224 const char* subMenuTexts[] = {"Main","Song","Ins.","Scopes","Jam"};
225 const pp_int32 subMenuIDs[] = {BUTTON_0, BUTTON_0+1, BUTTON_0+2, BUTTON_0+3, BUTTON_0+4};
226
227 pp_int32 dx = (screen->getWidth() - (4+38))/numSubMenus;
228
229 for (pp_int32 i = 0; i < numSubMenus; i++)
230 {
231 button = new PPButton(subMenuIDs[i], screen, this, PPPoint(0 + 2+i*dx, y+1), PPSize(dx, 13), false, true, false);
232 button->setColor(TrackerConfig::colorThemeMain);
233 button->setTextColor(PPUIConfig::getInstance()->getColor(PPUIConfig::ColorStaticText));
234 button->setText(subMenuTexts[i]);
235 container->addControl(button);
236 }
237
238 button = new PPButton(BUTTON_APP_EXIT, screen, this, PPPoint(0 + 6+numSubMenus*dx, y+2), PPSize(35,11));
239 button->setText("Exit");
240 container->addControl(button);
241
242 screen->addControl(container);
243 }
244
245 sectionSwitcher->updateSubMenusButtons(false);
246 sectionSwitcher->showCurrentSubMenu(false);
247
248 pp_int32 peCtrlHeight = screen->getHeight()-UPPERSECTIONDEFAULTHEIGHT()-INPUTCONTAINERHEIGHT_DEFAULT;
249
250 patternEditorControl = new PatternEditorControl(PATTERN_EDITOR, screen, this,
251 PPPoint(0,0),
252 PPSize(screen->getWidth(),peCtrlHeight));
253
254 initInputContainerDefault(0, screen->getHeight()-UPPERSECTIONDEFAULTHEIGHT()-INPUTCONTAINERHEIGHT_DEFAULT);
255 initInputContainerExtended(0, screen->getHeight()-UPPERSECTIONDEFAULTHEIGHT()-INPUTCONTAINERHEIGHT_EXTENDED);
256 #else
257 PPContainer* containerAbout = new PPContainer(CONTAINER_ABOUT, screen, this, PPPoint(116-2, 0), PPSize((306-116+2)+14,24), false);
258 containerAbout->setColor(TrackerConfig::colorThemeMain);
259
260 // Song title edit field
261 PPListBox* listBox = new PPListBox(LISTBOX_SONGTITLE, screen, this, PPPoint(116-2+2, 2+8), PPSize(200+2,12), true, true, false);
262 listBox->showSelection(false);
263 listBox->setSingleButtonClickEdit(true);
264 listBox->setBorderColor(TrackerConfig::colorThemeMain);
265
266 char str[MP_MAXTEXT+1];
267 moduleEditor->getTitle(str, ModuleEditor::MAX_TITLETEXT);
268
269 listBox->addItem(str);
270 listBox->setMaxEditSize(ModuleEditor::MAX_TITLETEXT);
271
272 containerAbout->addControl(listBox);
273
274 PPStaticText* staticText = playTimeText = new PPStaticText(STATICTEXT_ABOUT_TIME, screen, this, PPPoint(116+2, 2+8+3), "", false);
275 containerAbout->addControl(staticText);
276
277 button = new PPButton(BUTTON_ABOUT_ESTIMATESONGLENGTH, screen, this, PPPoint(containerAbout->getLocation().x + containerAbout->getSize().width - 6*8-4, 2+8+2), PPSize(6*8, 9));
278 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
279 button->setText("estimate");
280 containerAbout->addControl(button);
281
282 peakLevelControl = new PeakLevelControl(PEAKLEVEL_CONTROL, screen, this, PPPoint(116-2+2, 2+8), PPSize(200+2,12));
283 peakLevelControl->setBorderColor(TrackerConfig::colorThemeMain);
284 containerAbout->addControl(peakLevelControl);
285
286 staticText = new PPStaticText(STATICTEXT_ABOUT_HEADING, screen, this, PPPoint(116, 3), "Song title:", true);
287 staticText->setFont(PPFont::getFont(PPFont::FONT_TINY));
288 containerAbout->addControl(staticText);
289
290 // switch to Peak level
291 pp_int32 aboutButtonOffset = 51;
292
293 button = new PPButton(BUTTON_ABOUT_FOLLOWSONG, screen, this, PPPoint(containerAbout->getLocation().x + containerAbout->getSize().width - aboutButtonOffset, 1), PPSize(12, 9), false, true, false);
294 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
295 button->setText("F");
296 containerAbout->addControl(button);
297
298 button = new PPButton(BUTTON_ABOUT_PROSPECTIVE, screen, this, PPPoint(containerAbout->getLocation().x + containerAbout->getSize().width - aboutButtonOffset + 12, 1), PPSize(12, 9), false, true, false);
299 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
300 button->setText("P");
301 button->setPressed(true);
302 containerAbout->addControl(button);
303
304 button = new PPButton(BUTTON_ABOUT_WRAPCURSOR, screen, this, PPPoint(containerAbout->getLocation().x + containerAbout->getSize().width - aboutButtonOffset + 12*2, 1), PPSize(12, 9), false, true, false);
305 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
306 button->setText("W");
307 containerAbout->addControl(button);
308
309 button = new PPButton(BUTTON_ABOUT_LIVESWITCH, screen, this, PPPoint(containerAbout->getLocation().x + containerAbout->getSize().width - aboutButtonOffset + 12*3, 1), PPSize(12, 9), false, true, false);
310 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
311 button->setText("L");
312 containerAbout->addControl(button);
313
314 aboutButtonOffset+=34;
315
316 button = new PPButton(BUTTON_ABOUT_SHOWPEAK, screen, this, PPPoint(containerAbout->getLocation().x + containerAbout->getSize().width - aboutButtonOffset, 1), PPSize(30, 9), false, true, false);
317 button->setColor(TrackerConfig::colorThemeMain);
318 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
319 button->setText("Peak");
320 button->setTextColor(PPUIConfig::getInstance()->getColor(PPUIConfig::ColorStaticText));
321 containerAbout->addControl(button);
322
323 aboutButtonOffset+=30;
324
325 button = new PPButton(BUTTON_ABOUT_SHOWTIME, screen, this, PPPoint(containerAbout->getLocation().x + containerAbout->getSize().width - aboutButtonOffset, 1), PPSize(30, 9), false, true, false);
326 button->setColor(TrackerConfig::colorThemeMain);
327 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
328 button->setText("Time");
329 button->setTextColor(PPUIConfig::getInstance()->getColor(PPUIConfig::ColorStaticText));
330 containerAbout->addControl(button);
331
332 aboutButtonOffset+=30;
333
334 button = new PPButton(BUTTON_ABOUT_SHOWTITLE, screen, this, PPPoint(containerAbout->getLocation().x + containerAbout->getSize().width - aboutButtonOffset, 1), PPSize(30, 9), false, true, false);
335 button->setColor(TrackerConfig::colorThemeMain);
336 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
337 button->setText("Title");
338 button->setTextColor(PPUIConfig::getInstance()->getColor(PPUIConfig::ColorStaticText));
339 containerAbout->addControl(button);
340
341 screen->addControl(containerAbout);
342
343 // small sections
344 initSectionOrderlist(0,0);
345
346 initSectionSpeed(116-2,24);
347
348 initSectionPattern(116-4+99,24);
349
350 // Main options
351 initSectionMainOptions(0, 64);
352
353 // ---------- Instrument & Sample listboxes ----------
354 initListboxesSection(320, 0);
355
356 #ifndef __LOWRES__
357 scopesControl = new ScopesControl(SCOPES_CONTROL, screen, this,
358 PPPoint(0, UPPERSECTIONDEFAULTHEIGHTWOINS()),
359 PPSize(screen->getWidth(), SCOPESHEIGHT()));
360 scopesControl->setBorderColor(TrackerConfig::colorThemeMain);
361 for (c = 0; c < TrackerConfig::MAXCHANNELS; c++)
362 scopesControl->recordChannel(c, playerController->isChannelRecording(c));
363 screen->addControl(scopesControl);
364 screen->paintControl(scopesControl, false);
365
366 PPContainer* containerOpenRemoveTabs = new PPContainer(CONTAINER_OPENREMOVETABS, screen, this,
367 PPPoint(0, screen->getHeight()-TABHEADERHEIGHT()),
368 PPSize(TABHEADERHEIGHT()*2, TABHEADERHEIGHT()),
369 false);
370 containerOpenRemoveTabs->setColor(TrackerConfig::colorThemeMain);
371
372 button = new PPButton(BUTTON_TAB_OPEN, screen, this,
373 PPPoint(1, screen->getHeight()-TABHEADERHEIGHT()+1),
374 PPSize(TABHEADERHEIGHT()-2, TABHEADERHEIGHT()-2),
375 false);
376 button->setText("+");
377 containerOpenRemoveTabs->addControl(button);
378
379 button = new PPButton(BUTTON_TAB_CLOSE, screen, this,
380 PPPoint(TABHEADERHEIGHT(), screen->getHeight()-TABHEADERHEIGHT()+1),
381 PPSize(TABHEADERHEIGHT()-2, TABHEADERHEIGHT()-2),
382 false);
383 button->setText("-");
384 containerOpenRemoveTabs->addControl(button);
385 screen->addControl(containerOpenRemoveTabs);
386
387 TabHeaderControl* tabHeader = new TabHeaderControl(TABHEADER_CONTROL, screen, this,
388 PPPoint(TABHEADERHEIGHT()*2, screen->getHeight() - TABHEADERHEIGHT()),
389 PPSize(screen->getWidth()-TABHEADERHEIGHT()*2, TABHEADERHEIGHT()));
390 tabHeader->setColor(TrackerConfig::colorThemeMain);
391 screen->addControl(tabHeader);
392
393 #endif
394
395 patternEditorControl = new PatternEditorControl(PATTERN_EDITOR, screen, this,
396 PPPoint(0,UPPERSECTIONDEFAULTHEIGHT()),
397 PPSize(screen->getWidth(),MAXEDITORHEIGHT()-UPPERSECTIONDEFAULTHEIGHT()));
398 #endif
399 // first thing to do is, attach pattern editor
400 patternEditorControl->attachPatternEditor(moduleEditor->getPatternEditor());
401 patternEditorControl->setColor(TrackerConfig::colorPatternEditorBackground);
402 patternEditorControl->setOrderlistIndex(getOrderListBoxIndex());
403
404 screen->addControl(patternEditorControl);
405
406 // ---------- update fields --------------
407 updateSamplesListBox(false);
408 updateSongLength(false);
409 updateSongRepeat(false);
410
411 //updateBPM(false);
412 updateSpeed(false);
413 updatePatternAddAndOctave(false);
414
415 updatePatternIndex(false);
416 updatePatternLength(false);
417
418 updatePatternEditorControl(false);
419
420 #ifdef __LOWRES__
421 switchEditMode(EditModeMilkyTracker);
422 #else
423 switchEditMode(EditModeFastTracker);
424 #endif
425
426 screen->setFocus(patternEditorControl);
427
428 #ifdef __LOWRES__
429 setInputControl(SIPDefault);
430 updateJamMenuOrder(false);
431 #endif
432
433 TitlePageManager titlePageManager(*screen);
434 titlePageManager.showSongTitleEditField(false);
435
436 setFollowSong(true, false);
437 setProspectiveMode(false, false);
438 setCursorWrapAround(true, false);
439
440 for (c = 0; c < TrackerConfig::MAXCHANNELS; c++)
441 {
442 scopesControl->recordChannel(c, playerController->isChannelRecording(c));
443 getPatternEditorControl()->recordChannel(c, playerController->isChannelRecording(c));
444 }
445
446 patternEditorControl->setScrollMode(ScrollModeStayInCenter);
447
448 scopesControl->attachSource(this->playerController);
449
450 tabManager->openNewTab(this->playerController, this->moduleEditor);
451 }
452
453 ////////////////////////////////////////////////////////////////////
454 // Build orderlist section
455 ////////////////////////////////////////////////////////////////////
initSectionOrderlist(pp_int32 x,pp_int32 y)456 void Tracker::initSectionOrderlist(pp_int32 x, pp_int32 y)
457 {
458 // setup controls
459 PPContainer* containerOrderlist = new PPContainer(CONTAINER_ORDERLIST, screen, this, PPPoint(x, y), PPSize(116-2,64), false);
460 containerOrderlist->setColor(TrackerConfig::colorThemeMain);
461
462 PPButton* button = new PPButton(BUTTON_ORDERLIST_EXTENT, screen, this, PPPoint(x + 2 + 78 - 2 - 22, y + 2), PPSize(19, 10), false);
463 button->setColor(TrackerConfig::colorThemeMain);
464 button->setTextColor(PPUIConfig::getInstance()->getColor(PPUIConfig::ColorStaticText));
465 button->setText(TrackerConfig::stringButtonCollapsed);
466 containerOrderlist->addControl(button);
467
468 // DUP
469 button = new PPButton(BUTTON_ORDERLIST_SEQENTRY, screen, this, PPPoint(x + 2 + 78 - 2 - 22, y+2+12), PPSize(18, 11));
470 //button->setVerticalText(true);
471 button->setXOffset(-1);
472 button->setText("Seq");
473 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
474 containerOrderlist->addControl(button);
475
476 button = new PPButton(BUTTON_ORDERLIST_CLNENTRY, screen, this, PPPoint(x + 2 + 78 - 2 - 22, y+2+12+12), PPSize(18, 11));
477 //button->setVerticalText(true);
478 button->setXOffset(-1);
479 button->setText("Cln");
480 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
481 containerOrderlist->addControl(button);
482
483 button = new PPButton(BUTTON_ORDERLIST_INSERT, screen, this, PPPoint(x+2 + 78-2, y+2), PPSize(33, 11));
484 button->setText("Ins.");
485 containerOrderlist->addControl(button);
486
487 button = new PPButton(BUTTON_ORDERLIST_NEXT, screen, this, PPPoint(x+2 + 78-2, y+2+12), PPSize(16, 11));
488 button->setText(TrackerConfig::stringButtonPlus);
489 containerOrderlist->addControl(button);
490
491 button = new PPButton(BUTTON_ORDERLIST_PREVIOUS, screen, this, PPPoint(x+2 + 78-2 + 17, y+2+12), PPSize(16, 11));
492 button->setText(TrackerConfig::stringButtonMinus);
493 containerOrderlist->addControl(button);
494
495 button = new PPButton(BUTTON_ORDERLIST_DELETE, screen, this, PPPoint(x+2 + 78-2, y+2+12+12), PPSize(33, 11));
496 button->setText("Del");
497 containerOrderlist->addControl(button);
498
499 button = new PPButton(BUTTON_ORDERLIST_SONGLENGTH_PLUS, screen, this, PPPoint(x+2 + 78-2, y+2+12+12+12), PPSize(16, 11));
500 button->setText(TrackerConfig::stringButtonPlus);
501 containerOrderlist->addControl(button);
502
503 button = new PPButton(BUTTON_ORDERLIST_SONGLENGTH_MINUS, screen, this, PPPoint(x+2 + 78-2 + 17, y+2+12+12+12), PPSize(16, 11));
504 button->setText(TrackerConfig::stringButtonMinus);
505 containerOrderlist->addControl(button);
506
507 button = new PPButton(BUTTON_ORDERLIST_REPEAT_PLUS, screen, this, PPPoint(x+2 + 78-2, y+2+12+12+12+12), PPSize(16, 11));
508 button->setText(TrackerConfig::stringButtonPlus);
509 containerOrderlist->addControl(button);
510
511 button = new PPButton(BUTTON_ORDERLIST_REPEAT_MINUS, screen, this, PPPoint(x+2 + 78-2 + 17, y+2+12+12+12+12), PPSize(16, 11));
512 button->setText(TrackerConfig::stringButtonMinus);
513 containerOrderlist->addControl(button);
514
515 PPStaticText* staticText = new PPStaticText(0, NULL, NULL, PPPoint(x+2, y+2+12+12+12+2), "Length", true);
516 containerOrderlist->addControl(staticText);
517
518 staticText = new PPStaticText(1, NULL, NULL, PPPoint(x+2 + 54, y+2+12+12+12+12+2), "Len.", true);
519 containerOrderlist->addControl(staticText);
520
521 // actual Song Length field
522 staticText = new PPStaticText(STATICTEXT_ORDERLIST_SONGLENGTH, screen, NULL, PPPoint(x+2 + 8*7, y+2+12+12+12+2), "", false);
523 containerOrderlist->addControl(staticText);
524
525 staticText = new PPStaticText(2, NULL, NULL, PPPoint(x+2, y+2+12+12+12+12+2), "Repeat", true);
526 containerOrderlist->addControl(staticText);
527
528 // actual Song repeat field
529 staticText = new PPStaticText(STATICTEXT_ORDERLIST_REPEAT, screen, NULL, PPPoint(x+2 + 8*7, y+2+12+12+12+12+2), "", false);
530 containerOrderlist->addControl(staticText);
531
532 listBoxOrderList = new PPListBox(LISTBOX_ORDERLIST, screen, this, PPPoint(x+2, y+2), PPSize(51,36), true, false, true, true);
533 listBoxOrderList->setAutoHideVScroll(false);
534 listBoxOrderList->setBorderColor(TrackerConfig::colorThemeMain);
535 listBoxOrderList->setCenterSelection(true);
536 listBoxOrderList->setSelectOnScroll(true);
537
538 containerOrderlist->addControl(listBoxOrderList);
539
540 screen->addControl(containerOrderlist);
541
542 expandOrderlist(false);
543 }
544
545 ////////////////////////////////////////////////////////////////////
546 // Build speed section
547 ////////////////////////////////////////////////////////////////////
initSectionSpeed(pp_int32 x,pp_int32 y)548 void Tracker::initSectionSpeed(pp_int32 x, pp_int32 y)
549 {
550 PPContainer* containerSpeed = new PPContainer(CONTAINER_SPEED, screen, this, PPPoint(x, y), PPSize(99-2,40), false);
551 containerSpeed->setColor(TrackerConfig::colorThemeMain);
552
553 PPStaticText* staticText = new PPStaticText(STATICTEXT_SPEED_BPM_DESC, NULL, NULL, PPPoint(x+2, y+2+2), "BPM", true);
554 containerSpeed->addControl(staticText);
555
556 // actual BPM field
557 staticText = new PPStaticText(STATICTEXT_SPEED_BPM, screen, NULL, PPPoint(x+2 + 4*8 - 5, y+2+2), "", false);
558 containerSpeed->addControl(staticText);
559
560 // Octave text field goes at the same place but hidden by default
561 staticText = new PPStaticText(STATICTEXT_SPEED_OCTAVE_DESC, NULL, NULL, PPPoint(x+2, y+2+2), "Oct", true);
562 staticText->hide(true);
563 containerSpeed->addControl(staticText);
564
565 // actual octave field, hidden by default
566 staticText = new PPStaticText(STATICTEXT_SPEED_OCTAVE, screen, NULL, PPPoint(x+2 + 5*8 - 5, y+2+2), "", false);
567 staticText->hide(true);
568 containerSpeed->addControl(staticText);
569
570 staticText = new PPStaticText(STATICTEXT_SPEED_SPEED_DESC, NULL, NULL, PPPoint(x+2, y+2 + 2 + 12), "Spd", true);
571 containerSpeed->addControl(staticText);
572
573 // actual speed field
574 staticText = new PPStaticText(STATICTEXT_SPEED_SPEED, screen, NULL, PPPoint(x+2 + 5*8 - 5, y+2 + 2 + 12), "", false);
575 containerSpeed->addControl(staticText);
576
577 staticText = new PPStaticText(STATICTEXT_SPEED_PATTERNADD_DESC, NULL, NULL, PPPoint(x+2, y+2 + 2 + 12 + 12), "Add", true);
578 containerSpeed->addControl(staticText);
579
580 // actual speed field
581 staticText = new PPStaticText(STATICTEXT_SPEED_PATTERNADD, screen, NULL, PPPoint(x+2 + 5*8 - 5, y+2 + 2 + 12 + 12), "", false);
582 containerSpeed->addControl(staticText);
583
584 staticText = new PPStaticText(STATICTEXT_SPEED_MAINVOL_DESC, NULL, NULL, PPPoint(x+2, y+2 + 2 + 12 + 12), "Mainvol", true);
585 staticText->hide(true);
586 containerSpeed->addControl(staticText);
587
588 // actual speed field
589 staticText = new PPStaticText(STATICTEXT_SPEED_MAINVOL, screen, NULL, PPPoint(x+2 + 8*8 - 3, y+2 + 2 + 12 + 12), "xx", false);
590 staticText->hide(true);
591 containerSpeed->addControl(staticText);
592
593 const pp_int32 bSize = 14;
594
595 PPButton* button = new PPButton(BUTTON_BPM_PLUS, screen, this, PPPoint(x + 2 + 54, y+2), PPSize(bSize, 11));
596 button->setText(TrackerConfig::stringButtonPlus);
597 containerSpeed->addControl(button);
598
599 // octave plus button, hidden by default
600 button = new PPButton(BUTTON_OCTAVE_PLUS, screen, this, PPPoint(x + 2 + 54, y+2), PPSize(bSize, 11));
601 button->setText(TrackerConfig::stringButtonPlus);
602 button->hide(true);
603 containerSpeed->addControl(button);
604
605 button = new PPButton(BUTTON_BPM_MINUS, screen, this, PPPoint(x + 2 + 54 + bSize+1, y+2), PPSize(bSize-1, 11));
606 button->setText(TrackerConfig::stringButtonMinus);
607 containerSpeed->addControl(button);
608
609 // octave minus button, hidden by default
610 button = new PPButton(BUTTON_OCTAVE_MINUS, screen, this, PPPoint(x + 2 + 54 + bSize+1, y+2), PPSize(bSize-1, 11));
611 button->setText(TrackerConfig::stringButtonMinus);
612 button->hide(true);
613 containerSpeed->addControl(button);
614
615 button = new PPButton(BUTTON_SPEED_PLUS, screen, this, PPPoint(x + 2 + 54, y+2 + 12), PPSize(bSize, 11));
616 button->setText(TrackerConfig::stringButtonPlus);
617 containerSpeed->addControl(button);
618
619 button = new PPButton(BUTTON_SPEED_MINUS, screen, this, PPPoint(x + 2 + 54 + bSize+1, y+2 + 12), PPSize(bSize-1, 11));
620 button->setText(TrackerConfig::stringButtonMinus);
621 containerSpeed->addControl(button);
622
623 button = new PPButton(BUTTON_ADD_PLUS, screen, this, PPPoint(x + 2 + 54, y+2 + 12 + 12), PPSize(bSize, 11));
624 button->setText(TrackerConfig::stringButtonPlus);
625 containerSpeed->addControl(button);
626
627 button = new PPButton(BUTTON_ADD_MINUS, screen, this, PPPoint(x + 2 + 54 + bSize+1, y+2 + 12 + 12), PPSize(bSize-1, 11));
628 button->setText(TrackerConfig::stringButtonMinus);
629 containerSpeed->addControl(button);
630
631 button = new PPButton(BUTTON_SPEEDCONTAINERFLIP, screen, this, PPPoint(button->getLocation().x + button->getSize().width+1, y+1), PPSize(10, 37), false);
632 button->setColor(TrackerConfig::colorThemeMain);
633 button->setTextColor(PPUIConfig::getInstance()->getColor(PPUIConfig::ColorStaticText));
634 button->setText("Flip");
635 button->setVerticalText(true);
636 containerSpeed->addControl(button);
637
638 screen->addControl(containerSpeed);
639 }
640
641 ////////////////////////////////////////////////////////////////////
642 // Build pattern section
643 ////////////////////////////////////////////////////////////////////
initSectionPattern(pp_int32 x,pp_int32 y)644 void Tracker::initSectionPattern(pp_int32 x, pp_int32 y)
645 {
646 PPContainer* containerPattern = new PPContainer(CONTAINER_PATTERN, screen, this, PPPoint(x, y), PPSize(91+14+4,40), false);
647 containerPattern->setColor(TrackerConfig::colorThemeMain);
648
649 PPStaticText* staticText = new PPStaticText(0, NULL, NULL, PPPoint(x + 2, y+2 + 2), "Patn.", true);
650 containerPattern->addControl(staticText);
651
652 // actual pattern index field
653 staticText = new PPStaticText(STATICTEXT_PATTERN_INDEX, screen, NULL, PPPoint(x + 2 + 4 * 8 + 18, y+2 + 2), "", false);
654 containerPattern->addControl(staticText);
655
656 staticText = new PPStaticText(0, NULL, NULL, PPPoint(x + 2, y+2 + 2 + 12), "Len.", true);
657 containerPattern->addControl(staticText);
658
659 // actual pattern length field
660 staticText = new PPStaticText(STATICTEXT_PATTERN_LENGTH, screen, NULL, PPPoint(x + 2 + 3 * 8 + 18, y+2 + 2 + 12), "", false);
661 containerPattern->addControl(staticText);
662
663 PPButton* button = new PPButton(BUTTON_PATTERN_PLUS, screen, this, PPPoint(x + 2 + 52+18, y+2), PPSize(16, 11));
664 button->setText(TrackerConfig::stringButtonPlus);
665
666 containerPattern->addControl(button);
667
668 button = new PPButton(BUTTON_PATTERN_MINUS, screen, this, PPPoint(x + 2 + 52 + 17+18, y+2), PPSize(17, 11));
669 button->setText(TrackerConfig::stringButtonMinus);
670
671 containerPattern->addControl(button);
672
673 button = new PPButton(BUTTON_PATTERN_SIZE_PLUS, screen, this, PPPoint(x + 2 + 52+18, y+2 + 12), PPSize(16, 11));
674 button->setText(TrackerConfig::stringButtonPlus);
675
676 containerPattern->addControl(button);
677
678 button = new PPButton(BUTTON_PATTERN_SIZE_MINUS, screen, this, PPPoint(x + 2 + 52 + 17+18, y+2 + 12), PPSize(17, 11));
679 button->setText(TrackerConfig::stringButtonMinus);
680
681 containerPattern->addControl(button);
682
683 button = new PPButton(BUTTON_PATTERN_EXPAND, screen, this, PPPoint(x + 3, y+2 + 12 + 12), PPSize(51, 11));
684 button->setText("Expand");
685
686 containerPattern->addControl(button);
687
688 button = new PPButton(BUTTON_PATTERN_SHRINK, screen, this, PPPoint(x + 3 + 52, y+2 + 12 +12), PPSize(51, 11));
689 button->setText("Shrink");
690
691 containerPattern->addControl(button);
692
693 screen->addControl(containerPattern);
694 }
695
696 /////////////////////////////////////////////////////////////
697 // Build main options section
698 /////////////////////////////////////////////////////////////
initSectionMainOptions(pp_int32 x,pp_int32 y)699 void Tracker::initSectionMainOptions(pp_int32 x, pp_int32 y)
700 {
701 pp_int32 i,j;
702
703 #ifndef __LOWRES__
704 pp_int32 bHeight = 12;
705 PPSize size(320, 54);
706 #else
707 pp_int32 bHeight = 14;
708 PPSize size(320, 64);
709 #endif
710
711 PPContainer* container = new PPContainer(CONTAINER_MENU, screen, this, PPPoint(x, y), size, false);
712 container->setColor(TrackerConfig::colorThemeMain);
713
714 #ifdef __LOWRES__
715 y+=2;
716 #endif
717
718 PPButton* button;
719
720 for (j = 0; j < 4; j++)
721 {
722 for (i = 0; i < 4; i++)
723 {
724 if (j * 4 + i < 15)
725 {
726 button = new PPButton(BUTTON_MENU_ITEM_0 + j*4+i, screen, this, PPPoint(x+4 + i*78, y + 3 + j*bHeight), PPSize(77, bHeight-1));
727 button->setText("Unused");
728
729 container->addControl(button);
730 }
731 }
732
733 }
734
735 static_cast<PPButton*>(container->getControlByID(MAINMENU_PLAY_SONG))->setText("Play Sng");
736 static_cast<PPButton*>(container->getControlByID(MAINMENU_PLAY_PATTERN))->setText("Play Pat");
737 //static_cast<PPButton*>(container->getControlByID(MAINMENU_STOP))->setText("Stop");
738 // Setup "Stop" PPButton
739 button = static_cast<PPButton*>(container->getControlByID(MAINMENU_STOP));
740 button->setText("Stop");
741 button->setSize(PPSize(77>>1, bHeight-1));
742 // Add "Edit" button
743 button = new PPButton(MAINMENU_EDIT, screen, this,
744 PPPoint(button->getLocation().x + button->getSize().width+1, button->getLocation().y),
745 PPSize(77>>1, bHeight-1), true, true, false);
746
747 button->setText("Rec");
748
749 container->addControl(button);
750
751 static_cast<PPButton*>(container->getControlByID(MAINMENU_ZAP))->setText("Zap");
752 static_cast<PPButton*>(container->getControlByID(MAINMENU_LOAD))->setText("Load");
753 // Setup "Save" button
754 button = static_cast<PPButton*>(container->getControlByID(MAINMENU_SAVE));
755 button->setText("Save");
756 button->setSize(PPSize(77>>1, bHeight-1));
757 // Add "Save As" button
758 button = new PPButton(MAINMENU_SAVEAS, screen, this,
759 PPPoint(button->getLocation().x + button->getSize().width+1, button->getLocation().y),
760 PPSize(77>>1, bHeight-1));
761
762 button->setText("As" PPSTR_PERIODS);
763
764 container->addControl(button);
765
766 //static_cast<PPButton*>(container->getControlByID(MAINMENU_SAVE));
767 static_cast<PPButton*>(container->getControlByID(MAINMENU_DISKMENU))->setText("Disk Op.");
768 static_cast<PPButton*>(container->getControlByID(MAINMENU_INSEDIT))->setText("Ins. Ed.");
769 static_cast<PPButton*>(container->getControlByID(MAINMENU_SMPEDIT))->setText("Smp. Ed.");
770 static_cast<PPButton*>(container->getControlByID(MAINMENU_ADVEDIT))->setText("Adv. Edit");
771 static_cast<PPButton*>(container->getControlByID(MAINMENU_TRANSPOSE))->setText("Transpose");
772 static_cast<PPButton*>(container->getControlByID(MAINMENU_CONFIG))->setText("Config");
773 static_cast<PPButton*>(container->getControlByID(MAINMENU_QUICKOPTIONS))->setText("Options");
774 static_cast<PPButton*>(container->getControlByID(MAINMENU_OPTIMIZE))->setText("Optimize");
775 static_cast<PPButton*>(container->getControlByID(MAINMENU_ABOUT))->setText("About");
776
777 // add/subtract channels
778 button = new PPButton(BUTTON_MENU_ITEM_ADDCHANNELS, screen, this, PPPoint(x+4 + 3*78, y + 3 + 3*bHeight), PPSize((77>>1) - 1, bHeight-1));
779 button->setText("Add");
780 container->addControl(button);
781
782 button = new PPButton(BUTTON_MENU_ITEM_SUBCHANNELS, screen, this, PPPoint(x+4 + 3*78 + (77>>1), y + 3 + 3*bHeight), PPSize((77>>1)+1, bHeight-1));
783 button->setText("Sub");
784 container->addControl(button);
785
786 button = static_cast<PPButton*>(container->getControlByID(MAINMENU_PLAY_PATTERN));
787 button->setText("Pat");
788 button->setSize(PPSize((77>>1)-1, bHeight-1));
789
790 PPPoint p = button->getLocation();
791 p.x+=button->getSize().width+1;
792
793 button = new PPButton(MAINMENU_PLAY_POSITION, screen, this, p, PPSize((77>>1)+1, bHeight-1));
794 button->setText("Pos");
795 container->addControl(button);
796
797 screen->addControl(container);
798 }
799
initListboxesSection(pp_int32 x,pp_int32 y)800 void Tracker::initListboxesSection(pp_int32 x, pp_int32 y)
801 {
802 pp_int32 size = (screen->getWidth()-x) / 2 - 4;
803
804 if (size > 236)
805 size = 236;
806
807 #ifndef __LOWRES__
808 const pp_int32 tinyButtonHeight = 10;
809 const pp_int32 tinyButtonOffset = -1;
810 pp_int32 height = 118;
811 pp_int32 dy = 4;
812 #else
813 const pp_int32 tinyButtonHeight = 9;
814 const pp_int32 tinyButtonOffset = -1;
815 pp_int32 height = 64;
816 pp_int32 dy = 3;
817 #endif
818
819 PPButton* button;
820
821 // Crippled main menu & jam menu
822 #ifdef __LOWRES__
823 pp_int32 myDx = 55;
824 {
825 pp_int32 bHeight = 14;
826
827 pp_int32 x2 = x+4;
828 pp_int32 y2 = y+2+3;
829
830 PPContainer* container = new PPContainer(CONTAINER_LOWRES_TINYMENU, screen, this, PPPoint(x, y), PPSize((size-myDx)+7,height), false);
831 container->setColor(TrackerConfig::colorThemeMain);
832
833 button = new PPButton(MAINMENU_PLAY_SONG, screen, this, PPPoint(x2, y2), PPSize(73, bHeight-1));
834 button->setText("Play Sng");
835 container->addControl(button);
836
837 button = new PPButton(MAINMENU_PLAY_PATTERN, screen, this, PPPoint(x2, y2 + 1*bHeight), PPSize(73, bHeight-1));
838 button->setText("Play Pat");
839 container->addControl(button);
840
841 /*button = new PPButton(MAINMENU_STOP, screen, this, PPPoint(x2, y2 + 2*bHeight), PPSize(73, bHeight-1));
842 button->setText("Stop");
843 container->addControl(button);*/
844
845 button = new PPButton(MAINMENU_STOP, screen, this, PPPoint(x2, y2 + 2*bHeight), PPSize((73>>1) - 1, bHeight-1));
846 button->setText("Stop");
847 container->addControl(button);
848
849 button = new PPButton(MAINMENU_EDIT, screen, this, PPPoint(x2 + (73>>1), y2 + 2*bHeight), PPSize((73>>1)+1, bHeight-1), true, true, false);
850 button->setText("Rec");
851 container->addControl(button);
852
853 button = new PPButton(BUTTON_MENU_ITEM_ADDCHANNELS, screen, this, PPPoint(x2, y2 + 3*bHeight), PPSize((73>>1) - 1, bHeight-1));
854 button->setText("Add");
855 container->addControl(button);
856
857 button = new PPButton(BUTTON_MENU_ITEM_SUBCHANNELS, screen, this, PPPoint(x2 + (73>>1), y2 + 3*bHeight), PPSize((73>>1)+1, bHeight-1));
858 button->setText("Sub");
859 container->addControl(button);
860
861 x2+=74;
862
863 button = new PPButton(MAINMENU_INSEDIT, screen, this, PPPoint(x2, y2), PPSize(26, bHeight-1));
864 button->setText("Ins");
865 container->addControl(button);
866
867 button = new PPButton(MAINMENU_SMPEDIT, screen, this, PPPoint(x2, y2 + 1*bHeight), PPSize(26, bHeight-1));
868 button->setText("Smp");
869 container->addControl(button);
870
871 button = new PPButton(MAINMENU_ADVEDIT, screen, this, PPPoint(x2, y2 + 2*bHeight), PPSize(26, bHeight-1));
872 button->setText("Adv");
873 container->addControl(button);
874
875 button = new PPButton(MAINMENU_TRANSPOSE, screen, this, PPPoint(x2, y2 + 3*bHeight), PPSize(26, bHeight-1));
876 button->setText("Trn");
877 container->addControl(button);
878
879 // play pattern/position
880 button = static_cast<PPButton*>(container->getControlByID(MAINMENU_PLAY_PATTERN));
881 button->setText("Pat");
882 button->setSize(PPSize((73>>1)-1, bHeight-1));
883
884 PPPoint p = button->getLocation();
885 p.x+=button->getSize().width+1;
886
887 button = new PPButton(MAINMENU_PLAY_POSITION, screen, this, p, PPSize((73>>1)+1, bHeight-1));
888 button->setText("Pos");
889 container->addControl(button);
890
891 screen->addControl(container);
892
893 x+=(size-myDx)+7;
894 }
895
896 size-=4;
897
898 {
899 pp_int32 height2 = height + 39 + 14;
900 pp_int32 y3 = y - 39 - 14;
901
902 pp_int32 x2 = 0+4;
903
904 PPContainer* container = new PPContainer(CONTAINER_LOWRES_JAMMENU, screen, this, PPPoint(0, y3), PPSize(screen->getWidth(),height2), false);
905 container->setColor(TrackerConfig::colorThemeMain);
906
907 pp_int32 bHeight = 12;
908 pp_int32 y2 = y3 + 1;
909
910 PianoControl* pianoControl = new PianoControl(PIANO_CONTROL, screen, inputControlListener,
911 PPPoint(container->getLocation().x+2, y2), PPSize(screen->getWidth() - 4, 25*3+12), ModuleEditor::MAX_NOTE);
912 // show C-3
913 pianoControl->setBorderColor(TrackerConfig::colorThemeMain);
914 pianoControl->setMode(PianoControl::ModePlay);
915 pianoControl->setxScale(6);
916 pianoControl->setyScale(3);
917 pianoControl->assureNoteVisible(12*4);
918
919 container->addControl(pianoControl);
920
921 x2 = 0+4;
922 y2+=pianoControl->getSize().height+1;
923
924 PPStaticText* staticText = new PPStaticText(0, NULL, NULL, PPPoint(x2, y2+2), "Pos", true);
925 container->addControl(staticText);
926
927 staticText = new PPStaticText(STATICTEXT_JAMMENU_CURORDER, NULL, NULL, PPPoint(x2 + 3*8+4, y2+2), "FF");
928 container->addControl(staticText);
929
930 button = new PPButton(BUTTON_JAMMENU_NEXTORDERLIST, screen, this, PPPoint(x2 + 5*8+4 + 1, y2), PPSize(12, 11));
931 button->setText(TrackerConfig::stringButtonPlus);
932 container->addControl(button);
933
934 button = new PPButton(BUTTON_JAMMENU_PREVORDERLIST, screen, this, PPPoint(button->getLocation().x + button->getSize().width+1, y2), PPSize(12, 11));
935 button->setText(TrackerConfig::stringButtonMinus);
936 container->addControl(button);
937
938 pp_int32 x3 = button->getLocation().x + button->getSize().width+3;
939
940 staticText = new PPStaticText(0, NULL, NULL, PPPoint(x3, y2+2), "Pat", true);
941 container->addControl(staticText);
942
943 staticText = new PPStaticText(STATICTEXT_JAMMENU_CURPATTERN, NULL, NULL, PPPoint(x3 + 3*8+4, y2+2), "FF");
944 container->addControl(staticText);
945
946 button = new PPButton(BUTTON_PATTERN_PLUS, screen, this, PPPoint(x3 + 5*8+4 + 1, y2), PPSize(12, 11));
947 button->setText(TrackerConfig::stringButtonPlus);
948 container->addControl(button);
949
950 button = new PPButton(BUTTON_PATTERN_MINUS, screen, this, PPPoint(button->getLocation().x + button->getSize().width+1, y2), PPSize(12, 11));
951 button->setText(TrackerConfig::stringButtonMinus);
952 container->addControl(button);
953
954 x3 = button->getLocation().x + button->getSize().width+3;
955
956 staticText = new PPStaticText(0, NULL, NULL, PPPoint(x3, y2+2), "Ins", true);
957 container->addControl(staticText);
958
959 staticText = new PPStaticText(STATICTEXT_JAMMENU_CURINSTRUMENT, NULL, NULL, PPPoint(x3 + 3*8+4, y2+2), "FF");
960 container->addControl(staticText);
961
962 button = new PPButton(BUTTON_JAMMENU_NEXTINSTRUMENT, screen, this, PPPoint(x3 + 5*8+4 + 1, y2), PPSize(12, 11));
963 button->setText(TrackerConfig::stringButtonUp);
964 container->addControl(button);
965
966 button = new PPButton(BUTTON_JAMMENU_PREVINSTRUMENT, screen, this, PPPoint(button->getLocation().x + button->getSize().width+1, y2), PPSize(12, 11));
967 button->setText(TrackerConfig::stringButtonDown);
968 container->addControl(button);
969
970 button = new PPButton(INPUT_BUTTON_INS, screen, inputControlListener, PPPoint(button->getLocation().x + button->getSize().width+1 + 2, y2), PPSize(17, 11));
971 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
972 button->setText("Ins");
973 container->addControl(button);
974
975 button = new PPButton(INPUT_BUTTON_DEL, screen, inputControlListener, PPPoint(button->getLocation().x + button->getSize().width+1, y2), PPSize(17, 11));
976 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
977 button->setText("Del");
978 container->addControl(button);
979
980 button = new PPButton(INPUT_BUTTON_BACK, screen, inputControlListener, PPPoint(button->getLocation().x + button->getSize().width+1, y2), PPSize(22, 11));
981 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
982 button->setText("Back");
983 container->addControl(button);
984
985 button = new PPButton(INPUT_BUTTON_KEYOFF, screen, inputControlListener, PPPoint(button->getLocation().x + button->getSize().width+1, y2), PPSize(17, 11));
986 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
987 button->setText("Off");
988 container->addControl(button);
989
990 button = new PPButton(BUTTON_JAMMENU_TOGGLEPIANOSIZE, screen, this, PPPoint(button->getLocation().x + button->getSize().width+3, y2+1), PPSize(12, 11), false);
991 button->setColor(TrackerConfig::colorThemeMain);
992 button->setTextColor(PPUIConfig::getInstance()->getColor(PPUIConfig::ColorStaticText));
993 button->setText(TrackerConfig::stringButtonCollapsed);
994 container->addControl(button);
995
996 x2 = 0+4;
997 y2+=14;
998
999 button = new PPButton(MAINMENU_PLAY_SONG, screen, this, PPPoint(x2, y2), PPSize(77, bHeight-1));
1000 button->setText("Play Sng");
1001 container->addControl(button);
1002
1003 x2+=button->getSize().width+1;
1004 button = new PPButton(MAINMENU_PLAY_PATTERN, screen, this, PPPoint(x2, y2), PPSize((77>>1)-1, bHeight-1));
1005 button->setText("Pat");
1006 container->addControl(button);
1007
1008 x2+=button->getSize().width+1;
1009 button = new PPButton(MAINMENU_PLAY_POSITION, screen, this, PPPoint(x2, y2), PPSize((77>>1)+1, bHeight-1));
1010 button->setText("Pos");
1011 container->addControl(button);
1012
1013 x2+=button->getSize().width+1;
1014 button = new PPButton(MAINMENU_STOP, screen, this, PPPoint(x2, y2), PPSize((77>>1), bHeight-1));
1015 button->setText("Stop");
1016 container->addControl(button);
1017
1018 // Add "Edit" button
1019 x2+=button->getSize().width+1;
1020 button = new PPButton(MAINMENU_EDIT, screen, this, PPPoint(x2, y2), PPSize((77>>1), bHeight-1), true, true, false);
1021 button->setText("Rec");
1022 container->addControl(button);
1023
1024 x2+=button->getSize().width+1;
1025 button = new PPButton(BUTTON_MENU_ITEM_ADDCHANNELS, screen, this, PPPoint(x2, y2), PPSize((77>>1) - 1, bHeight-1));
1026 button->setText("Add");
1027 container->addControl(button);
1028
1029 x2+=button->getSize().width+1;
1030 button = new PPButton(BUTTON_MENU_ITEM_SUBCHANNELS, screen, this, PPPoint(x2, y2), PPSize((77>>1)+1, bHeight-1));
1031 button->setText("Sub");
1032 container->addControl(button);
1033
1034 screen->addControl(container);
1035 }
1036 #else
1037 pp_int32 myDx = 0;
1038 #endif
1039
1040 PPContainer* container = new PPContainer(CONTAINER_INSTRUMENTLIST, screen, this, PPPoint(x, y), PPSize(screen->getWidth()-x,height), false);
1041 container->setColor(TrackerConfig::colorThemeMain);
1042
1043 // Instruments
1044 #ifndef __LOWRES__
1045 button = new PPButton(BUTTON_INSTRUMENT, screen, this, PPPoint(x+2, y+dy-2), PPSize(screen->getWidth() < 800 ? 3*8+4 : 11*8+4, 12), false, true, false);
1046 button->setText(screen->getWidth() < 800 ? "Ins" : "Instruments");
1047 button->setColor(TrackerConfig::colorThemeMain);
1048 button->setTextColor(PPUIConfig::getInstance()->getColor(PPUIConfig::ColorStaticText));
1049 button->setPressed(true);
1050 //PPStaticText* staticText = new PPStaticText(0, NULL, NULL, PPPoint(x+3, y+dy), screen->getWidth() < 800 ? "Ins" : "Instruments", true);
1051 #else
1052 button = new PPButton(BUTTON_INSTRUMENT, screen, this, PPPoint(x+2, y+dy-2), PPSize(11*8+4, 11), false, true, false);
1053 button->setText("Instruments");
1054 button->setColor(TrackerConfig::colorThemeMain);
1055 button->setTextColor(PPUIConfig::getInstance()->getColor(PPUIConfig::ColorStaticText));
1056 button->setPressed(true);
1057 {
1058 PPStaticText* staticText = new PPStaticText(STATICTEXT_INSTRUMENTS_ALTERNATIVEHEADER, screen, this, PPPoint(x+3, y+dy), "Samples / Ins:", true);
1059 staticText->hide(true);
1060 container->addControl(staticText);
1061
1062 staticText = new PPStaticText(STATICTEXT_INSTRUMENTS_ALTERNATIVEHEADER2, screen, this, PPPoint(x+3 + 14*8, y+dy), "xx", false);
1063 staticText->hide(true);
1064 container->addControl(staticText);
1065 }
1066 #endif
1067 container->addControl(button);
1068
1069 button = new PPButton(BUTTON_INSTRUMENTS_PLUS, screen, this, PPPoint(x+button->getSize().width+4, y+dy+tinyButtonOffset), PPSize(15, tinyButtonHeight));
1070 button->setText(TrackerConfig::stringButtonPlus);
1071 container->addControl(button);
1072
1073 button = new PPButton(BUTTON_INSTRUMENTS_MINUS, screen, this, PPPoint(button->getLocation().x + 16, y+dy+tinyButtonOffset), PPSize(15, tinyButtonHeight));
1074 button->setText(TrackerConfig::stringButtonMinus);
1075 container->addControl(button);
1076
1077 #ifndef __LOWRES__
1078 button = new PPButton(BUTTON_INSTRUMENTEDITOR_CLEAR, screen, sectionInstruments, PPPoint(x+2 + size - 2 - 92, y+dy+tinyButtonOffset), PPSize(30, tinyButtonHeight));
1079 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
1080 button->setText("Zap");
1081 container->addControl(button);
1082
1083 button = new PPButton(BUTTON_INSTRUMENTEDITOR_LOAD, screen, sectionInstruments, PPPoint(x+2 + size - 2 - 61, y+dy+tinyButtonOffset), PPSize(30, tinyButtonHeight));
1084 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
1085 button->setText("Load");
1086 container->addControl(button);
1087
1088 button = new PPButton(BUTTON_INSTRUMENTEDITOR_SAVE, screen, sectionInstruments, PPPoint(x+2 + size - 2 - 30, y+dy+tinyButtonOffset), PPSize(30, tinyButtonHeight));
1089 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
1090 button->setText("Save");
1091 container->addControl(button);
1092 #else
1093 button = new PPButton(BUTTON_INSTRUMENTS_FLIP, screen, this, PPPoint(container->getLocation().x + container->getSize().width - 27, y+dy+tinyButtonOffset - 1), PPSize(24, 11), false);
1094 button->setText("Flip");
1095 button->setColor(TrackerConfig::colorThemeMain);
1096 button->setTextColor(PPUIConfig::getInstance()->getColor(PPUIConfig::ColorStaticText));
1097 container->addControl(button);
1098
1099 button = new PPButton(BUTTON_JAMMENU_PREVINSTRUMENT, screen, this, PPPoint(button->getLocation().x - 16, y+dy+tinyButtonOffset), PPSize(15, tinyButtonHeight));
1100 button->setText(TrackerConfig::stringButtonUp);
1101 container->addControl(button);
1102
1103 button = new PPButton(BUTTON_JAMMENU_NEXTINSTRUMENT, screen, this, PPPoint(button->getLocation().x - 16, y+dy+tinyButtonOffset), PPSize(15, tinyButtonHeight));
1104 button->setText(TrackerConfig::stringButtonDown);
1105 container->addControl(button);
1106 #endif
1107
1108 listBoxInstruments = new PPListBox(LISTBOX_INSTRUMENTS, screen, this, PPPoint(x+2, y + 7 + dy + dy), PPSize(size+myDx,height-(10+2*dy)), true, true, true, true);
1109 listBoxInstruments->setBorderColor(TrackerConfig::colorThemeMain);
1110 listBoxInstruments->setShowIndex(true);
1111 listBoxInstruments->setMaxEditSize(ModuleEditor::MAX_INSTEXT);
1112 //listBoxInstruments->setSelectOnScroll(true);
1113
1114 fillInstrumentListBox(listBoxInstruments);
1115
1116 container->addControl(listBoxInstruments);
1117
1118 // Samples
1119 #ifndef __LOWRES__
1120 button = new PPButton(BUTTON_SAMPLE_EDIT_CLEAR, screen, sectionSamples, PPPoint(x+2 + size*2 + 4 - 2 - 92, y+dy+tinyButtonOffset), PPSize(30, tinyButtonHeight));
1121 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
1122 button->setText("Clear");
1123 container->addControl(button);
1124
1125 button = new PPButton(BUTTON_SAMPLE_LOAD, screen, sectionSamples, PPPoint(x+2 + size*2 + 4 - 2 - 61, y+dy+tinyButtonOffset), PPSize(30, tinyButtonHeight));
1126 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
1127 button->setText("Load");
1128 container->addControl(button);
1129
1130 button = new PPButton(BUTTON_SAMPLE_SAVE, screen, sectionSamples, PPPoint(x+2 + size*2 + 4 - 2 - 30, y+dy+tinyButtonOffset), PPSize(30, tinyButtonHeight));
1131 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
1132 button->setText("Save");
1133 container->addControl(button);
1134 #endif
1135
1136 PPStaticText* staticText = new PPStaticText(STATICTEXT_SAMPLEHEADER, NULL, NULL, PPPoint(x+size+myDx+4+3, y+dy), "Samples", true);
1137 container->addControl(staticText);
1138
1139 listBoxSamples = new PPListBox(LISTBOX_SAMPLES, screen, this, PPPoint(x+2 + size+4, y + 7 + dy + dy), PPSize(size,height-(10+2*dy)), true, true, true, true);
1140 listBoxSamples->setBorderColor(TrackerConfig::colorThemeMain);
1141 listBoxSamples->setShowIndex(true);
1142 listBoxSamples->setMaxEditSize(ModuleEditor::MAX_SMPTEXT);
1143 listBoxSamples->setIndexBaseCount(0);
1144
1145 container->addControl(listBoxSamples);
1146
1147 #ifdef __LOWRES__
1148 listBoxSamples->hide(true);
1149 #endif
1150
1151 screen->addControl(container);
1152 }
1153
showMessageBox(pp_int32 id,const PPString & caption,MessageBoxTypes type,bool update)1154 void Tracker::showMessageBox(pp_int32 id, const PPString& caption, MessageBoxTypes type, bool update/* = true*/)
1155 {
1156 showMessageBoxSized(id, caption, type, 290, 74, update);
1157 }
1158
showMessageBoxSized(pp_int32 id,const PPString & caption,MessageBoxTypes type,pp_int32 width,pp_int32 height,bool update)1159 void Tracker::showMessageBoxSized(pp_int32 id, const PPString& caption, MessageBoxTypes type, pp_int32 width/* = -1*/, pp_int32 height/* = -1*/, bool update/* = true*/)
1160 {
1161 if (messageBoxContainerGeneric)
1162 {
1163 delete messageBoxContainerGeneric;
1164 messageBoxContainerGeneric = NULL;
1165 }
1166
1167 PPSimpleVector<PPString>* stringList = PPTools::extractStringList(caption);
1168
1169 if (height == -1)
1170 height = 62 + stringList->size()*12;
1171
1172 if (width == -1)
1173 width = 290;
1174
1175 pp_int32 x = screen->getWidth() / 2 - width/2;
1176 pp_int32 y = screen->getHeight() / 2 - height/2;
1177
1178 PPMessageBoxContainer* container = new PPMessageBoxContainer(id, screen, this, PPPoint(x, y), PPSize(width,height), "System request");
1179
1180 pp_int32 x2;
1181 pp_int32 y2;
1182
1183 y2 = y + 28;
1184
1185 for (pp_int32 i = 0; i < stringList->size(); i++)
1186 {
1187 PPString* str = stringList->get(i);
1188
1189 x2 = x + width / 2 - (PPFont::getFont(PPFont::FONT_SYSTEM)->getStrWidth(*str) / 2);
1190
1191 container->addControl(new PPStaticText(1 + i, screen, this, PPPoint(x2, y2), *str, true));
1192
1193 y2+=12;
1194 }
1195
1196 delete stringList;
1197
1198 y2 = y + height - 46;
1199
1200 if (type == MessageBox_OK)
1201 {
1202 PPButton* button = new PPButton(PP_MESSAGEBOX_BUTTON_YES, screen, this, PPPoint(x+width/2-30, y2 + 20), PPSize(60, 11));
1203 button->setText("Okay");
1204 container->addControl(button);
1205 }
1206 else if (type == MessageBox_YESNO)
1207 {
1208 PPButton* button = new PPButton(PP_MESSAGEBOX_BUTTON_YES, screen, this, PPPoint(x+width/2-65, y2 + 20), PPSize(60, 11));
1209 button->setText("Yes");
1210 container->addControl(button);
1211
1212 button = new PPButton(PP_MESSAGEBOX_BUTTON_NO, screen, this, PPPoint(x+width/2+5, y2 + 20), PPSize(60, 11));
1213 button->setText("No");
1214 container->addControl(button);
1215 }
1216 else if (type == MessageBox_YESNOCANCEL)
1217 {
1218 PPButton* button = new PPButton(PP_MESSAGEBOX_BUTTON_YES, screen, this, PPPoint(x+width/2-100, y2 + 20), PPSize(60, 11));
1219 button->setText("Yes");
1220 container->addControl(button);
1221
1222 button = new PPButton(PP_MESSAGEBOX_BUTTON_NO, screen, this, PPPoint(x+width/2-30, y2 + 20), PPSize(60, 11));
1223 button->setText("No");
1224 container->addControl(button);
1225
1226 button = new PPButton(PP_MESSAGEBOX_BUTTON_CANCEL, screen, this, PPPoint(x+width/2+40, y2 + 20), PPSize(60, 11));
1227 button->setText("Cancel");
1228 container->addControl(button);
1229 }
1230
1231 messageBoxContainerGeneric = container;
1232
1233 screen->setModalControl(messageBoxContainerGeneric, update);
1234 }
1235
showQuitMessageBox(const char * caption,const char * captionOk,const char * captionCancel)1236 void Tracker::showQuitMessageBox(const char* caption, const char* captionOk, const char* captionCancel)
1237 {
1238 showMessageBoxSized(MESSAGEBOX_REALLYQUIT, caption, MessageBox_YESNO, -1, -1, false);
1239
1240 if (captionOk)
1241 {
1242 PPButton* button = static_cast<PPButton*>(messageBoxContainerGeneric->getControlByID(PP_MESSAGEBOX_BUTTON_YES));
1243 button->setText(captionOk);
1244 }
1245
1246 if (captionCancel)
1247 {
1248 PPButton* button = static_cast<PPButton*>(messageBoxContainerGeneric->getControlByID(PP_MESSAGEBOX_BUTTON_NO));
1249 button->setText(captionCancel);
1250 }
1251
1252 screen->paint();
1253 }
1254
initInstrumentChooser(pp_int32 id,const PPString & buttonText1,const PPString & buttonText2,const PPString & caption,const PPString & userString1,const PPString & userString2,pp_int32 srcSelection,pp_int32 srcSelection2,pp_int32 srcSelection3)1255 void Tracker::initInstrumentChooser(pp_int32 id, const PPString& buttonText1, const PPString& buttonText2, const PPString& caption,
1256 const PPString& userString1, const PPString& userString2,
1257 pp_int32 srcSelection/* = -1*/, pp_int32 srcSelection2/* = -1*/, pp_int32 srcSelection3/* = -1*/)
1258 {
1259 if (instrumentChooser)
1260 {
1261 delete instrumentChooser;
1262 instrumentChooser = NULL;
1263 }
1264
1265 const pp_uint32 spacer = 10;
1266
1267 PPString buttonText1_2 = buttonText1;
1268 buttonText1_2.append("++");
1269
1270 PPString buttonText2_2 = buttonText2;
1271 buttonText2_2.append("++");
1272
1273 const pp_int32 height = (screen->getHeight() >= 480) ? 380 : screen->getHeight();
1274 const pp_int32 width = (screen->getWidth()-10) > 480 ? 480 : screen->getWidth();
1275
1276 pp_int32 x = screen->getWidth() / 2 - width/2;
1277 pp_int32 y = screen->getHeight() / 2 - height/2;
1278
1279 PPMessageBoxContainer* container = new PPMessageBoxContainer(id, screen, this, PPPoint(x, y), PPSize(width,height), caption);
1280
1281 // ------------- source listboxes ---------------------------------
1282 pp_int32 x2 = x + 5;
1283 pp_int32 y2 = y + 18;
1284
1285 pp_int32 lBoxHeight = ((height-100)/2) & ~1;
1286
1287 PPString str;
1288 PPListBox* listBoxInstrumentsSrc = NULL;
1289 PPListBox* listBoxSamplesSrc = NULL;
1290 PPListBox* listBoxModulesSrc = NULL;
1291 PPListBox* listBoxInstrumentsDst = NULL;
1292 PPListBox* listBoxSamplesDst = NULL;
1293 PPListBox* listBoxModulesDst = NULL;
1294
1295 if (tabManager->getNumTabs() > 1)
1296 {
1297 listBoxModulesSrc = new PPListBox(INSTRUMENT_CHOOSER_LIST_SRC3, screen, this,
1298 PPPoint(x2-2, y2 + 10), PPSize((width-10)/2,lBoxHeight), true, false, true, true);
1299 listBoxModulesSrc->setShowIndex(true);
1300
1301 fillModuleListBox(listBoxModulesSrc);
1302
1303 if (srcSelection3 >= 0)
1304 listBoxModulesSrc->setSelectedIndex(srcSelection3, false);
1305
1306 container->addControl(listBoxModulesSrc);
1307
1308 str = "From Module:";
1309
1310 container->addControl(new PPStaticText(0, screen, this, PPPoint(x2, y2), str, true));
1311
1312 PPButton* button = new PPButton(PP_MESSAGEBOX_BUTTON_USER5, screen, this,
1313 PPPoint(x2 - 2 + (width-10) / 2 - 50 - 1, y2-1),
1314 PPSize(50, 10));
1315
1316 button->setText("From<->To");
1317 container->addControl(button);
1318
1319 x2+=3+(width-10)/2+2;
1320
1321 pp_int32 temp = lBoxHeight;
1322 lBoxHeight = lBoxHeight / 2 - 6;
1323
1324 str = "From Ins:";
1325
1326 container->addControl(new PPStaticText(0, screen, this, PPPoint(x2, y2), str, true));
1327
1328 button = new PPButton(PP_MESSAGEBOX_BUTTON_USER10, screen, this,
1329 PPPoint(x2 + 9*8+4, y2-1),
1330 PPSize(14, 10));
1331
1332 button->setText("+");
1333 container->addControl(button);
1334
1335 button = new PPButton(PP_MESSAGEBOX_BUTTON_USER11, screen, this,
1336 PPPoint(x2 + 9*8+4 + 14 + 1, y2-1),
1337 PPSize(14, 10));
1338
1339 button->setText("-");
1340 container->addControl(button);
1341
1342 listBoxInstrumentsSrc = new PPListBox(INSTRUMENT_CHOOSER_LIST_SRC, screen, this,
1343 PPPoint(x2-2, y2 + 10), PPSize((width-10)/2-1,lBoxHeight), true, false, true, true);
1344 listBoxInstrumentsSrc->setShowIndex(true);
1345
1346 fillInstrumentListBox(listBoxInstrumentsSrc,
1347 tabManager->getModuleEditorFromTabIndex(listBoxModulesSrc->getSelectedIndex()));
1348
1349 if (srcSelection >= 0)
1350 listBoxInstrumentsSrc->setSelectedIndex(srcSelection, false);
1351
1352 container->addControl(listBoxInstrumentsSrc);
1353
1354 y2+=listBoxInstrumentsSrc->getSize().height+12;
1355
1356 str = "From Smp:";
1357
1358 container->addControl(new PPStaticText(0, screen, this, PPPoint(x2, y2), str, true));
1359
1360 button = new PPButton(PP_MESSAGEBOX_BUTTON_USER6, screen, this,
1361 PPPoint(x2 + 9*8+4, y2-1),
1362 PPSize(24, 10));
1363
1364 button->setText("Play");
1365 container->addControl(button);
1366
1367
1368 listBoxSamplesSrc = new PPListBox(INSTRUMENT_CHOOSER_LIST_SRC2, screen, this,
1369 PPPoint(x2-2, y2 + 10), PPSize((width-10)/2-1,lBoxHeight), true, false, true, true);
1370 listBoxSamplesSrc->setShowIndex(true);
1371 listBoxSamplesSrc->setIndexBaseCount(0);
1372
1373 fillSampleListBox(listBoxSamplesSrc, listBoxInstrumentsSrc->getSelectedIndex(),
1374 tabManager->getModuleEditorFromTabIndex(listBoxModulesSrc->getSelectedIndex()));
1375
1376 if (srcSelection2 >= 0)
1377 listBoxSamplesSrc->setSelectedIndex(srcSelection2, false);
1378
1379 container->addControl(listBoxSamplesSrc);
1380
1381 lBoxHeight = temp;
1382 }
1383 else
1384 {
1385 str = "From Ins:";
1386
1387 container->addControl(new PPStaticText(0, screen, this, PPPoint(x2, y2), str, true));
1388
1389 PPButton* button = new PPButton(PP_MESSAGEBOX_BUTTON_USER10, screen, this,
1390 PPPoint(x2 + 9*8+4, y2-1),
1391 PPSize(14, 10));
1392
1393 button->setText("+");
1394 container->addControl(button);
1395
1396 button = new PPButton(PP_MESSAGEBOX_BUTTON_USER11, screen, this,
1397 PPPoint(x2 + 9*8+4 + 14 + 1, y2-1),
1398 PPSize(14, 10));
1399
1400 button->setText("-");
1401 container->addControl(button);
1402
1403 listBoxInstrumentsSrc = new PPListBox(INSTRUMENT_CHOOSER_LIST_SRC, screen, this,
1404 PPPoint(x+3, y2 + 10), PPSize((width-10)/2,lBoxHeight), true, false, true, true);
1405 listBoxInstrumentsSrc->setShowIndex(true);
1406
1407 fillInstrumentListBox(listBoxInstrumentsSrc);
1408
1409 if (srcSelection >= 0)
1410 listBoxInstrumentsSrc->setSelectedIndex(srcSelection, false);
1411
1412 container->addControl(listBoxInstrumentsSrc);
1413
1414 y2 = y+18;
1415 lBoxHeight = ((height-100)/2) & ~1;
1416
1417 str = "From Smp:";
1418
1419 x2+=3+(width-10)/2+2;
1420 container->addControl(new PPStaticText(0, screen, this, PPPoint(x2, y2), str, true));
1421
1422 button = new PPButton(PP_MESSAGEBOX_BUTTON_USER6, screen, this,
1423 PPPoint(x2 + 9*8+4, y2-1),
1424 PPSize(24, 10));
1425
1426 button->setText("Play");
1427 container->addControl(button);
1428
1429 listBoxSamplesSrc = new PPListBox(INSTRUMENT_CHOOSER_LIST_SRC2, screen, this,
1430 PPPoint(x+3+(width-10)/2+4, y2 + 10), PPSize((width-10)/2-1,lBoxHeight), true, false, true, true);
1431 listBoxSamplesSrc->setShowIndex(true);
1432 listBoxSamplesSrc->setIndexBaseCount(0);
1433
1434 fillSampleListBox(listBoxSamplesSrc, listBoxInstrumentsSrc->getSelectedIndex());
1435
1436 if (srcSelection2 >= 0)
1437 listBoxSamplesSrc->setSelectedIndex(srcSelection2, false);
1438
1439 container->addControl(listBoxSamplesSrc);
1440 }
1441
1442 y2+=listBoxSamplesSrc->getSize().height+12 + 3;
1443
1444 pp_int32 temp = PPFont::getFont(PPFont::FONT_SYSTEM)->getStrWidth(userString1) + 10 +
1445 PPFont::getFont(PPFont::FONT_SYSTEM)->getStrWidth(buttonText1) + 4 + spacer +
1446 PPFont::getFont(PPFont::FONT_SYSTEM)->getStrWidth(buttonText1_2) + 4 + spacer;
1447 x2 = x + width / 2 - (temp / 2);
1448 pp_int32 y3 = y2;
1449
1450 PPStaticText* text = new PPStaticText(INSTRUMENT_CHOOSER_USERSTR1, screen, this, PPPoint(x2, y2), userString1, true);
1451 container->addControl(text);
1452
1453 PPButton* button = new PPButton(PP_MESSAGEBOX_BUTTON_USER1, screen, this,
1454 PPPoint(text->getLocation().x + text->getSize().width+spacer+10, y2-2),
1455 PPSize(PPFont::getFont(PPFont::FONT_SYSTEM)->getStrWidth(buttonText1) + 4, 11));
1456 button->setText(buttonText1);
1457 container->addControl(button);
1458
1459 button = new PPButton(PP_MESSAGEBOX_BUTTON_USER3, screen, this,
1460 PPPoint(button->getLocation().x + button->getSize().width+spacer, y2-2),
1461 PPSize(PPFont::getFont(PPFont::FONT_SYSTEM)->getStrWidth(buttonText1_2) + 4, 11));
1462 button->setText(buttonText1_2);
1463 container->addControl(button);
1464
1465 // ------------- destination listboxes ---------------------------------
1466 y2+=12;
1467
1468 container->addControl(new PPSeperator(0, screen, PPPoint(x+4, y2), width-8, container->getColor(), true));
1469
1470 y2+=4;
1471 temp = y2;
1472 pp_int32 temp2 = lBoxHeight;
1473
1474 x2 = x + 5;
1475
1476 if (tabManager->getNumTabs() > 1)
1477 {
1478 listBoxModulesDst = new PPListBox(INSTRUMENT_CHOOSER_LIST_DST3, screen, this,
1479 PPPoint(x2-2, y2 + 10), PPSize((width-10)/2,lBoxHeight), true, false, true, true);
1480 listBoxModulesDst->setShowIndex(true);
1481 fillModuleListBox(listBoxModulesDst);
1482 container->addControl(listBoxModulesDst);
1483
1484 str = "To Module:";
1485
1486 container->addControl(new PPStaticText(0, screen, this, PPPoint(x2, y2), str, true));
1487
1488 PPButton* button = new PPButton(PP_MESSAGEBOX_BUTTON_USER5, screen, this,
1489 PPPoint(x2 - 2 + (width-10) / 2 - 50 - 1, y2-1),
1490 PPSize(50, 10));
1491
1492 button->setText("To<->From");
1493 container->addControl(button);
1494
1495 x2+=3+(width-10)/2+2;
1496
1497 lBoxHeight = lBoxHeight / 2 - 6;
1498
1499 str = "To Ins:";
1500
1501 container->addControl(new PPStaticText(0, screen, this, PPPoint(x2, y2), str, true));
1502
1503 button = new PPButton(PP_MESSAGEBOX_BUTTON_USER12, screen, this,
1504 PPPoint(x2 + 7*8+4, y2-1),
1505 PPSize(14, 10));
1506
1507 button->setText("+");
1508 container->addControl(button);
1509
1510 button = new PPButton(PP_MESSAGEBOX_BUTTON_USER13, screen, this,
1511 PPPoint(x2 + 7*8+4 + 14 + 1, y2-1),
1512 PPSize(14, 10));
1513
1514 button->setText("-");
1515 container->addControl(button);
1516
1517 listBoxInstrumentsDst = new PPListBox(INSTRUMENT_CHOOSER_LIST_DST, screen, this,
1518 PPPoint(x2-2, y2 + 10), PPSize((width-10)/2-1,lBoxHeight), true, false, true, true);
1519 listBoxInstrumentsDst->setShowIndex(true);
1520
1521 fillInstrumentListBox(listBoxInstrumentsDst,
1522 tabManager->getModuleEditorFromTabIndex(listBoxModulesDst->getSelectedIndex()));
1523
1524 container->addControl(listBoxInstrumentsDst);
1525
1526 y2+=listBoxInstrumentsDst->getSize().height+12;
1527
1528 str = "To Smp:";
1529
1530 container->addControl(new PPStaticText(0, screen, this, PPPoint(x2, y2), str, true));
1531
1532 button = new PPButton(PP_MESSAGEBOX_BUTTON_USER7, screen, this,
1533 PPPoint(x2 + 7*8+4, y2-1),
1534 PPSize(24, 10));
1535
1536 button->setText("Play");
1537 container->addControl(button);
1538
1539 listBoxSamplesDst = new PPListBox(INSTRUMENT_CHOOSER_LIST_DST2, screen, this,
1540 PPPoint(x2-2, y2 + 10), PPSize((width-10)/2-1,lBoxHeight), true, false, true, true);
1541 listBoxSamplesDst->setShowIndex(true);
1542 listBoxSamplesDst->setIndexBaseCount(0);
1543
1544 fillSampleListBox(listBoxSamplesDst, listBoxInstrumentsDst->getSelectedIndex(),
1545 tabManager->getModuleEditorFromTabIndex(listBoxModulesDst->getSelectedIndex()));
1546
1547 container->addControl(listBoxSamplesDst);
1548 }
1549 else
1550 {
1551 str = "To Ins:";
1552
1553 container->addControl(new PPStaticText(0, screen, this, PPPoint(x2, y2), str, true));
1554
1555 PPButton* button = new PPButton(PP_MESSAGEBOX_BUTTON_USER12, screen, this,
1556 PPPoint(x2 + 7*8+4, y2-1),
1557 PPSize(14, 10));
1558
1559 button->setText("+");
1560 container->addControl(button);
1561
1562 button = new PPButton(PP_MESSAGEBOX_BUTTON_USER13, screen, this,
1563 PPPoint(x2 + 7*8+4 + 14 + 1, y2-1),
1564 PPSize(14, 10));
1565
1566 button->setText("-");
1567 container->addControl(button);
1568
1569 // put in here
1570 listBoxInstrumentsDst = new PPListBox(INSTRUMENT_CHOOSER_LIST_DST, screen, this,
1571 PPPoint(x+3, y2 + 10), PPSize((width-10)/2,lBoxHeight), true, false, true, true);
1572 listBoxInstrumentsDst->setShowIndex(true);
1573
1574 fillInstrumentListBox(listBoxInstrumentsDst);
1575
1576 container->addControl(listBoxInstrumentsDst);
1577
1578 y2 = temp;
1579 lBoxHeight = temp2;
1580
1581 str = "To Smp:";
1582
1583 //x2 = x + width / 2 - (PPFont::getFont(PPFont::FONT_SYSTEM)->getStrWidth(str2) / 2);
1584 //y2+=listBoxInstruments->getSize().height+16;
1585
1586 x2+=3+(width-10)/2+2;
1587 container->addControl(new PPStaticText(0, screen, this, PPPoint(x2, y2), str, true));
1588
1589 button = new PPButton(PP_MESSAGEBOX_BUTTON_USER7, screen, this,
1590 PPPoint(x2 + 7*8+4, y2-1),
1591 PPSize(24, 10));
1592
1593 button->setText("Play");
1594 container->addControl(button);
1595
1596 listBoxSamplesDst = new PPListBox(INSTRUMENT_CHOOSER_LIST_DST2, screen, this,
1597 PPPoint(x+3+(width-10)/2+4, y2 + 10), PPSize((width-10)/2-1,lBoxHeight), true, false, true, true);
1598 listBoxSamplesDst->setShowIndex(true);
1599 listBoxSamplesDst->setIndexBaseCount(0);
1600
1601 fillSampleListBox(listBoxSamplesDst, listBoxInstrumentsDst->getSelectedIndex());
1602
1603 container->addControl(listBoxSamplesDst);
1604 }
1605
1606 y2+=listBoxSamplesDst->getSize().height+12 + 3;
1607
1608 temp = PPFont::getFont(PPFont::FONT_SYSTEM)->getStrWidth(userString2) + 10 +
1609 PPFont::getFont(PPFont::FONT_SYSTEM)->getStrWidth(buttonText2) + 4 + spacer +
1610 PPFont::getFont(PPFont::FONT_SYSTEM)->getStrWidth(buttonText2_2) + 4 + spacer;
1611 x2 = x + width / 2 - (temp / 2);
1612 y3 = y2;
1613
1614 text = new PPStaticText(INSTRUMENT_CHOOSER_USERSTR2, screen, this, PPPoint(x2, y2), userString2, true);
1615 container->addControl(text);
1616
1617 button = new PPButton(PP_MESSAGEBOX_BUTTON_USER2, screen, this,
1618 PPPoint(text->getLocation().x + text->getSize().width+spacer+10, y2-2),
1619 PPSize(PPFont::getFont(PPFont::FONT_SYSTEM)->getStrWidth(buttonText2) + 4, 11));
1620 button->setText(buttonText2);
1621 container->addControl(button);
1622
1623 button = new PPButton(PP_MESSAGEBOX_BUTTON_USER4, screen, this,
1624 PPPoint(button->getLocation().x + button->getSize().width+spacer, y2-2),
1625 PPSize(PPFont::getFont(PPFont::FONT_SYSTEM)->getStrWidth(buttonText2_2) + 4, 11));
1626 button->setText(buttonText2_2);
1627 container->addControl(button);
1628
1629 // Buttons
1630 y2+=12;
1631
1632 container->addControl(new PPSeperator(0, screen, PPPoint(x+4, y2), width-8, container->getColor(), true));
1633
1634 y2+=7;
1635
1636 //PPButton* button = new PPButton(MESSAGEBOX_BUTTON_USER1, screen, this, PPPoint(x+width/2-75-35, y2), PPSize(70, 11));
1637 //button->setText(buttonText1);
1638 //container->addControl(button);
1639
1640 //button = new PPButton(MESSAGEBOX_BUTTON_USER2, screen, this, PPPoint(x+width/2-35, y2), PPSize(70, 11));
1641 //button->setText(buttonText2);
1642 //container->addControl(button);
1643
1644 button = new PPButton(PP_MESSAGEBOX_BUTTON_CANCEL, screen, this, PPPoint(x+width/2-35, y2), PPSize(70, 11));
1645 button->setText("Cancel");
1646 container->addControl(button);
1647
1648 instrumentChooser = container;
1649 }
1650
initAdvEdit()1651 void Tracker::initAdvEdit()
1652 {
1653 const pp_int32 buttonIDs[4] = {PP_MESSAGEBOX_BUTTON_USER1,
1654 PP_MESSAGEBOX_BUTTON_USER2,
1655 PP_MESSAGEBOX_BUTTON_USER3,
1656 PP_MESSAGEBOX_BUTTON_USER4};
1657
1658 const char* buttonTexts[4] = {"Track",
1659 "Pattern",
1660 "Song",
1661 "Block"};
1662
1663
1664 char buffer[100];
1665
1666 sprintf(buffer, "Remap ins. %x to %x", listBoxInstruments->getSelectedIndex()+1, 1);
1667
1668 //initInstrumentChooser(MESSAGEBOX_INSREMAP, "", "Instrument remapping", "",buffer, "",listBoxInstruments->getSelectedIndex());
1669 // old instrument chooser / just inserted ;)
1670 {
1671 PPString userString = buffer;
1672 pp_int32 srcSelection = listBoxInstruments->getSelectedIndex();
1673
1674 if (instrumentChooser)
1675 {
1676 delete instrumentChooser;
1677 instrumentChooser = NULL;
1678 }
1679
1680 const pp_int32 height = 222;
1681 const pp_int32 width = (screen->getWidth()-10) > 480 ? 480 : (screen->getWidth()-10);
1682
1683 pp_int32 x = screen->getWidth() / 2 - width/2;
1684 pp_int32 y = screen->getHeight() / 2 - height/2;
1685
1686 PPMessageBoxContainer* container = new PPMessageBoxContainer(MESSAGEBOX_INSREMAP, screen, this, PPPoint(x, y), PPSize(width,height), "Instrument remapping");
1687
1688 const PPString str = "From:";
1689
1690 pp_int32 x2 = x + 5;
1691 pp_int32 y2 = y + 20;
1692
1693 container->addControl(new PPStaticText(0, screen, this, PPPoint(x2, y2), str, true));
1694
1695 const pp_int32 lBoxHeight = height-90;
1696
1697 PPListBox* listBoxInstruments = new PPListBox(INSTRUMENT_CHOOSER_LIST_SRC, screen, this, PPPoint(x+3, y2 + 12), PPSize((width-10)/2,lBoxHeight), true, false, true, true);
1698 listBoxInstruments->setShowIndex(true);
1699
1700 fillInstrumentListBox(listBoxInstruments);
1701
1702 if (srcSelection >= 0)
1703 listBoxInstruments->setSelectedIndex(srcSelection, false);
1704
1705 container->addControl(listBoxInstruments);
1706
1707 PPString str2 = "To:";
1708
1709 x2+=3+(width-10)/2+2;
1710 container->addControl(new PPStaticText(0, screen, this, PPPoint(x2, y2), str2, true));
1711
1712 listBoxInstruments = new PPListBox(INSTRUMENT_CHOOSER_LIST_DST, screen, this, PPPoint(x+3+(width-10)/2+4, y2 + 12), PPSize((width-10)/2,lBoxHeight), true, false, true, true);
1713 listBoxInstruments->setShowIndex(true);
1714
1715 fillInstrumentListBox(listBoxInstruments);
1716
1717 container->addControl(listBoxInstruments);
1718
1719 y2+=listBoxInstruments->getSize().height+12 + 6 + 30;
1720
1721 PPButton* button = new PPButton(PP_MESSAGEBOX_BUTTON_USER1, screen, this, PPPoint(x+width/2-65, y2), PPSize(60, 11));
1722 button->setText("");
1723 container->addControl(button);
1724
1725 button = new PPButton(PP_MESSAGEBOX_BUTTON_CANCEL, screen, this, PPPoint(x+width/2+5, y2), PPSize(60, 11));
1726 button->setText("Cancel");
1727 container->addControl(button);
1728
1729 x2 = x + width / 2 - (PPFont::getFont(PPFont::FONT_SYSTEM)->getStrWidth(userString) / 2);
1730
1731 container->addControl(new PPStaticText(INSTRUMENT_CHOOSER_USERSTR1, screen, this, PPPoint(x2, y2 - 21), userString, true));
1732
1733 instrumentChooser = container;
1734 }
1735
1736 // modify current instrument chooser dialog
1737 if (instrumentChooser)
1738 {
1739 const pp_int32 spacer = 10;
1740
1741 PPControl* ctrl = instrumentChooser->getControlByID(PP_MESSAGEBOX_BUTTON_USER1);
1742 pp_int32 y2 = ctrl->getLocation().y - 16;
1743
1744 pp_int32 buttonWidth = ctrl->getSize().width;
1745 pp_int32 buttonHeight = ctrl->getSize().height;
1746 pp_int32 cx = ((buttonWidth) * 4 + spacer*3)/2;
1747
1748 bool b = instrumentChooser->removeControl(ctrl);
1749 ASSERT(b);
1750 b = instrumentChooser->removeControl(instrumentChooser->getControlByID(PP_MESSAGEBOX_BUTTON_CANCEL));
1751 ASSERT(b);
1752
1753 pp_int32 width = instrumentChooser->getSize().width;
1754
1755 pp_int32 x = instrumentChooser->getLocation().x + width/2 - cx;
1756
1757 for (pp_int32 i = 0; i < 4; i++)
1758 {
1759 PPButton* button = new PPButton(buttonIDs[i], screen, this, PPPoint(x, y2), PPSize(buttonWidth, buttonHeight));
1760 button->setText(buttonTexts[i]);
1761 instrumentChooser->addControl(button);
1762
1763 x+= buttonWidth + spacer;
1764 }
1765
1766 x-=buttonWidth + spacer;
1767 y2+=6 + buttonHeight;
1768
1769 PPButton* button = new PPButton(PP_MESSAGEBOX_BUTTON_CANCEL, screen, this, PPPoint(x, y2), PPSize(buttonWidth, buttonHeight));
1770 button->setText("Cancel");
1771 instrumentChooser->addControl(button);
1772
1773 ctrl = instrumentChooser->getControlByID(INSTRUMENT_CHOOSER_USERSTR1);
1774 y2 = ctrl->getLocation().y - 11;
1775 x = ctrl->getLocation().x;
1776 ctrl->setLocation(PPPoint(x, y2));
1777
1778 }
1779
1780 screen->setModalControl(instrumentChooser);
1781 }
1782
initInputContainerDefault(pp_int32 x,pp_int32 y)1783 void Tracker::initInputContainerDefault(pp_int32 x, pp_int32 y)
1784 {
1785 PPContainer* container = new PPContainer(CONTAINER_INPUTDEFAULT, screen, this, PPPoint(0, y), PPSize(screen->getWidth(),INPUTCONTAINERHEIGHT_DEFAULT), false);
1786 container->setColor(TrackerConfig::colorThemeMain);
1787
1788 PPButton* button;
1789
1790 pp_int32 bWidth = 11;
1791 pp_int32 bHeight = 12;
1792 pp_int32 j,i;
1793 for (j = 0; j < 2; j++)
1794 for (i = 0; i < 8; i++)
1795 {
1796 char buffer[4];
1797 PPTools::convertToHex(buffer, j*8+i, 1);
1798 button = new PPButton(INPUT_BUTTON_0 + j*8+i, screen, inputControlListener, PPPoint(x+2 + i*(bWidth), y + 2 + j*(bHeight)), PPSize(bWidth, bHeight), false, true, true);
1799 button->setText(buffer);
1800
1801 container->addControl(button);
1802 }
1803
1804 pp_int32 y2 = y + /*2*(bHeight+1)+*/2;
1805 pp_int32 x2 = x + 3 + 8*(bWidth);
1806
1807 bWidth = 22;
1808
1809 pp_int32 x3 = x2-1;
1810 button = new PPButton(INPUT_BUTTON_DEL, screen, inputControlListener, PPPoint(x3, y2), PPSize(bWidth, bHeight), false, true, true);
1811 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
1812 button->setText("Del");
1813 container->addControl(button);
1814 y2+=button->getSize().height;
1815
1816 button = new PPButton(INPUT_BUTTON_INS, screen, inputControlListener, PPPoint(x3, y2), PPSize(bWidth, bHeight), false, true, true);
1817 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
1818 button->setText("Ins");
1819 container->addControl(button);
1820 y2+=button->getSize().height;
1821
1822 button = new PPButton(INPUT_BUTTON_BACK, screen, inputControlListener, PPPoint(x3, y2), PPSize(bWidth, bHeight), false, true, true);
1823 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
1824 button->setText("Back");
1825 container->addControl(button);
1826
1827 x2+=button->getSize().width;
1828
1829 x3+=button->getSize().width;
1830
1831 x3 = x+2;
1832
1833 bWidth = 44;
1834 button = new PPButton(INPUT_BUTTON_INSLINE, screen, inputControlListener, PPPoint(x3, y2), PPSize(bWidth, bHeight), false, true, true);
1835 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
1836 button->setText("Insline");
1837 container->addControl(button);
1838
1839 x3+=button->getSize().width;
1840 button = new PPButton(INPUT_BUTTON_BACKLINE, screen, inputControlListener, PPPoint(x3, y2), PPSize(bWidth, bHeight), false, true, true);
1841 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
1842 button->setText("Backline");
1843 container->addControl(button);
1844
1845 // piano test
1846 PianoControl* pianoControl = new PianoControl(PIANO_CONTROL, screen, inputControlListener,
1847 PPPoint(x2, y+1), PPSize(screen->getWidth() - 2 - x2 - (21+2), 25+12), ModuleEditor::MAX_NOTE);
1848 // show C-3
1849 pianoControl->assureNoteVisible(12*4);
1850 pianoControl->setBorderColor(TrackerConfig::colorThemeMain);
1851 pianoControl->setMode(PianoControl::ModePlay);
1852
1853 container->addControl(pianoControl);
1854
1855 x2+=1+pianoControl->getSize().width;
1856
1857 button = new PPButton(INPUT_BUTTON_KEYOFF, screen, inputControlListener, PPPoint(x2, y+2), PPSize(22, 18), false, true, true);
1858 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
1859 button->setText("Off");
1860 container->addControl(button);
1861
1862 button = new PPButton(INPUT_BUTTON_EXPAND, screen, inputControlListener, PPPoint(x2, y+2+18), PPSize(22, 17), false, true);
1863 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
1864 button->setColor(TrackerConfig::colorThemeMain);
1865 button->setTextColor(PPUIConfig::getInstance()->getColor(PPUIConfig::ColorStaticText));
1866 button->setText("Exp.");
1867 container->addControl(button);
1868
1869 inputContainerDefault = inputContainerCurrent = container;
1870
1871 screen->addControl(container);
1872 }
1873
initInputContainerExtended(pp_int32 x,pp_int32 y)1874 void Tracker::initInputContainerExtended(pp_int32 x, pp_int32 y)
1875 {
1876 PPContainer* container = new PPContainer(CONTAINER_INPUTEXTENDED, screen, this, PPPoint(0, y), PPSize(screen->getWidth(),INPUTCONTAINERHEIGHT_EXTENDED), false);
1877 container->setColor(TrackerConfig::colorThemeMain);
1878
1879 // First line of keys
1880 PPButton* button;
1881
1882 pp_int32 bWidth = 11;
1883 pp_int32 bHeight = 12;
1884 pp_int32 j,i, offset = 0;
1885 for (i = 0; i < (signed)sizeof(keyLine_0_lowerCase); i++)
1886 {
1887 button = new PPButton(keyLineIDs_0[i], screen, inputControlListener, PPPoint(x+2 + i*(bWidth)+offset, y + 2), PPSize(bWidth, bHeight), false, true, true);
1888 button->setText(keyLine_0_lowerCase[i]);
1889 container->addControl(button);
1890 }
1891
1892 offset = bWidth+(bWidth>>1)-1;
1893 pp_int32 y2 = y+bHeight;
1894 j = x + 2 + offset;
1895 for (i = 0; i < (signed)sizeof(keyLine_1_lowerCase); i++)
1896 {
1897 button = new PPButton(keyLineIDs_1[i], screen, inputControlListener, PPPoint(j, y2 + 2), PPSize(keyLineSizes_1[i], bHeight), false, true, true);
1898 button->setText(keyLine_1_lowerCase[i]);
1899 container->addControl(button);
1900 j+=keyLineSizes_1[i];
1901 }
1902 y2+=bHeight;
1903
1904 bHeight++;
1905 offset = (bWidth*2)-4;
1906 for (i = 0; i < (signed)sizeof(keyLine_2_lowerCase); i++)
1907 {
1908 button = new PPButton(keyLineIDs_2[i], screen, inputControlListener, PPPoint(x+2 + i*(bWidth)+offset, y2 + 2), PPSize(bWidth, bHeight), false, true, true);
1909 button->setText(keyLine_2_lowerCase[i]);
1910 container->addControl(button);
1911 }
1912
1913 y2+=bHeight;
1914
1915 bHeight--;
1916 offset = (bWidth+2)+1;
1917 for (i = 0; i < (signed)sizeof(keyLine_3_lowerCase); i++)
1918 {
1919 button = new PPButton(keyLineIDs_3[i], screen, inputControlListener, PPPoint(x+2 + i*(bWidth)+offset, y2 + 2), PPSize(bWidth, bHeight), false, true, true);
1920 button->setText(keyLine_3_lowerCase[i]);
1921 container->addControl(button);
1922 }
1923
1924 y2 = y + bHeight;
1925 bWidth = 15;
1926 offset = 0;
1927 button = new PPButton(INPUT_BUTTON_TAB, screen, inputControlListener, PPPoint(x+2 + offset, y2 + 2), PPSize(bWidth, bHeight), false, true, true);
1928 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
1929 button->setText("->");
1930 container->addControl(button);
1931
1932 y2 += bHeight;
1933 bHeight++;
1934 bWidth = 18;
1935 offset = 0;
1936 button = new PPButton(INPUT_BUTTON_CAPSLOCK, screen, inputControlListener, PPPoint(x+2 + offset, y2 + 2), PPSize(bWidth, bHeight), false, true, false);
1937 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
1938 button->setText("Cap");
1939 container->addControl(button);
1940 y2 += bHeight;
1941 bHeight--;
1942
1943 bWidth = 14;
1944 offset = 0;
1945 button = new PPButton(INPUT_BUTTON_LSHIFT, screen, inputControlListener, PPPoint(x+2 + offset, y2 + 2), PPSize(bWidth, bHeight), false, true, false);
1946 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
1947 button->setText("Sh");
1948 container->addControl(button);
1949
1950 bWidth = 23;
1951 pp_int32 x3 = x + 145;
1952 y2 = y;
1953 button = new PPButton(INPUT_BUTTON_BACK, screen, inputControlListener, PPPoint(x3, y2+2), PPSize(bWidth, bHeight), false, true, true);
1954 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
1955 button->setText("Back");
1956 container->addControl(button);
1957
1958 y2+=bHeight;
1959
1960 x3+=7;
1961 bWidth = 16;
1962 bHeight*=2;
1963 bHeight+=1;
1964
1965 button = new PPButton(INPUT_BUTTON_ENTER, screen, inputControlListener, PPPoint(x3, y2+2), PPSize(bWidth, bHeight), false, true, true);
1966 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
1967 button->setText("Ret");
1968 container->addControl(button);
1969
1970 y2+=bHeight;
1971 bHeight = 12;
1972 bWidth = 31;
1973 x3 = x + 135;
1974 button = new PPButton(INPUT_BUTTON_SPACE, screen, inputControlListener, PPPoint(x3+2 + offset, y2 + 2), PPSize(bWidth, bHeight), false, true, true);
1975 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
1976 button->setText("Space");
1977 container->addControl(button);
1978
1979 x3 += bWidth+2;
1980
1981 PianoControl* pianoControl = new PianoControl(PIANO_CONTROL, screen, inputControlListener,
1982 PPPoint(x3+2, y+1), PPSize(screen->getWidth() - 3 - x3, 25+12), ModuleEditor::MAX_NOTE);
1983 // show C-3
1984 pianoControl->assureNoteVisible(12*4);
1985 pianoControl->setBorderColor(TrackerConfig::colorThemeMain);
1986 pianoControl->setMode(PianoControl::ModePlay);
1987
1988 container->addControl(pianoControl);
1989
1990 // more stuff
1991 bWidth = 18;
1992
1993 button = new PPButton(INPUT_BUTTON_DEL, screen, inputControlListener, PPPoint(x3+2, y2+2), PPSize(bWidth, bHeight), false, true, true);
1994 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
1995 button->setText("Del");
1996 container->addControl(button);
1997 x3+=button->getSize().width;
1998
1999 button = new PPButton(INPUT_BUTTON_INS, screen, inputControlListener, PPPoint(x3+2, y2+2), PPSize(bWidth, bHeight), false, true, true);
2000 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
2001 button->setText("Ins");
2002 container->addControl(button);
2003 x3+=button->getSize().width;
2004
2005 bWidth = 37;
2006 button = new PPButton(INPUT_BUTTON_INSLINE, screen, inputControlListener, PPPoint(x3+2, y2+2), PPSize(bWidth, bHeight), false, true, true);
2007 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
2008 button->setText("Insline");
2009 container->addControl(button);
2010
2011 bWidth = 41;
2012 x3+=button->getSize().width;
2013 button = new PPButton(INPUT_BUTTON_BACKLINE, screen, inputControlListener, PPPoint(x3+2, y2+2), PPSize(bWidth, bHeight), false, true, true);
2014 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
2015 button->setText("Backline");
2016 container->addControl(button);
2017
2018 x3+=button->getSize().width+1;
2019 bWidth = 33;
2020 button = new PPButton(INPUT_BUTTON_SHRINK, screen, inputControlListener, PPPoint(x3+2, y2+2), PPSize(bWidth, bHeight), false, true);
2021 button->setFont(PPFont::getFont(PPFont::FONT_TINY));
2022 button->setText("Shrink");
2023 button->setColor(TrackerConfig::colorThemeMain);
2024 button->setTextColor(PPUIConfig::getInstance()->getColor(PPUIConfig::ColorStaticText));
2025 container->addControl(button);
2026
2027 container->hide(true);
2028
2029 inputContainerExtended = container;
2030
2031 screen->addControl(container);
2032 }
2033
moveInputControls(pp_uint32 deltay)2034 void Tracker::moveInputControls(pp_uint32 deltay)
2035 {
2036 PPContainer* container = static_cast<PPContainer*>(screen->getControlByID(CONTAINER_INPUTDEFAULT));
2037 ASSERT(container);
2038
2039 PPPoint p(0, deltay);
2040 container->move(p);
2041
2042 container = static_cast<PPContainer*>(screen->getControlByID(CONTAINER_INPUTEXTENDED));
2043 ASSERT(container);
2044
2045 container->move(p);
2046
2047 rearrangePatternEditorControlOrInstrumentContainer();
2048 }
2049
hideInputControl(bool bHide)2050 void Tracker::hideInputControl(bool bHide/* = true*/)
2051 {
2052 if (inputContainerCurrent && bHide)
2053 {
2054 inputContainerCurrent->show(false);
2055 }
2056 else if (inputContainerCurrent)
2057 {
2058 inputContainerCurrent->show(true);
2059 }
2060 }
2061