void TabHeaderControl::setNumTabs(pp_uint32 numTabs) { pp_int32 width = (size.width - 4) / numTabs; pp_int32 height = size.height - 4; if (minSize && width < minSize) width = minSize; if (maxSize && width > maxSize) width = maxSize; tabButtons.clear(); if ((signed)numTabs*width > size.width - 4) { numTabs = (size.width - (4+12+12)) / minSize; width = (size.width - (4+12+12)) / numTabs; delete leftButton; leftButton = new PPButton(0, parentScreen, this, PPPoint(location.x + size.width - (4+12+12) + 2, location.y + 2), PPSize(12, height), false); leftButton->setText("<"); delete rightButton; rightButton = new PPButton(1, parentScreen, this, PPPoint(location.x + size.width - (4+13) + 3, location.y + 2), PPSize(12, height), false); rightButton->setText(">"); } else { delete rightButton; rightButton = NULL; delete leftButton; leftButton = NULL; } PPPoint location = this->location; location.x += 2; location. y+= 2; for (pp_int32 i = 0; i < (signed)numTabs; i++) { PPButton* button = new PPButton(i+0x1000, parentScreen, this, location, PPSize(width, height), false, true, false); button->setText("Blabla"); button->setColor(*color); button->setAutoSizeFont(false); tabButtons.add(button); location.x+=width; } }
void PPContainer::adjustContainerSize() { PPSimpleVector<PPControl>& controls = getControls(); pp_int32 x1 = parentScreen->getWidth(); pp_int32 y1 = parentScreen->getHeight(); pp_int32 x2 = 0; pp_int32 y2 = 0; for (pp_int32 i = 0; i < controls.size(); i++) { PPControl* control = controls.get(i); PPPoint p = control->getLocation(); if (p.x < x1) x1 = p.x; if (p.y < y1) y1 = p.y; p.x+=control->getSize().width; p.y+=control->getSize().height; if (p.x > x2) x2 = p.x; if (p.y > y2) y2 = p.y; } setLocation(PPPoint(x1, y1)); setSize(PPSize(x2-x1, y2-y1)); }
PPPoint PPGamePoly::tilePosition(int pat,int tw) { int w = texTileSize.width +texTileStride.width; int h = texTileSize.height+texTileStride.height; if (w == 0) w = 1; int t = (tw/w); if (t == 0) t = 1; return PPPoint((pat % t)*w+texOffset.x,(pat / t)*h+texOffset.y); }
void PPSlider::initButtons() { PPPoint buttonDownPos, buttonBarPos; PPSize buttonBarSize; if (horizontal) { this->size.height = SLIDERBUTTONHEIGHT; this->size.width = oneDimSize; buttonDownPos = PPPoint(location.x + oneDimSize - SLIDERBUTTONWIDTH, location.y); buttonBarPos = PPPoint(location.x + SLIDERBUTTONWIDTH, location.y); buttonBarSize = PPSize((oneDimSize - SLIDERBUTTONWIDTH*2), SLIDERBUTTONHEIGHT); } else { this->size.width = SLIDERBUTTONWIDTH; this->size.height = oneDimSize; buttonDownPos = PPPoint(location.x, location.y + oneDimSize - SLIDERBUTTONHEIGHT); buttonBarPos = PPPoint(location.x, location.y + SLIDERBUTTONHEIGHT); buttonBarSize = PPSize(SLIDERBUTTONWIDTH, (oneDimSize - SLIDERBUTTONHEIGHT*2)); } backgroundButton = new PPButton(0, parentScreen, NULL, /*_Point(location.x + (horizontal?0:1), location.y + (horizontal?1:0))*/location, this->size, false); backgroundButton->setColor(backgroundColor); backgroundButton->setInvertShading(true); buttonUp = new PPButton(0, parentScreen, this, location, PPSize(SLIDERBUTTONWIDTH,SLIDERBUTTONHEIGHT), false); buttonUp->setText(!buttonSwap ? "-" : "+"); buttonDown = new PPButton(0, parentScreen, this, buttonDownPos , PPSize(SLIDERBUTTONWIDTH,SLIDERBUTTONHEIGHT), false); buttonDown->setText(!buttonSwap ? "+" : "-"); buttonBar = new PPButton(0, parentScreen, this, buttonBarPos, buttonBarSize, false, false); setBarSize(currentBarSize, false); setBarPosition(currentBarPosition, false); }
void SectionAbstract::replaceAndResizeInstrumentListContainer(pp_int32 listBoxContainerHeight) { PPScreen* screen = tracker.screen; PPContainer* ctrl = static_cast<PPContainer*>(screen->getControlByID(CONTAINER_INSTRUMENTLIST)); ctrl->getControlByID(BUTTON_INSTRUMENT)->setLocation(PPPoint(3,1)); ctrl->getControlByID(STATICTEXT_SAMPLEHEADER)->setLocation(PPPoint(160+3,3)); ctrl->getControlByID(BUTTON_INSTRUMENTS_PLUS)->setLocation(PPPoint(97,2)); ctrl->getControlByID(BUTTON_INSTRUMENTS_MINUS)->setLocation(PPPoint(97 + ctrl->getControlByID(BUTTON_INSTRUMENTS_PLUS)->getSize().width+1,2)); PPSize size = tracker.listBoxInstruments->getSize(); size.height = listBoxContainerHeight - 15; size.width = screen->getWidth() / 2 - 4; tracker.listBoxInstruments->setSize(size); PPPoint p = tracker.listBoxInstruments->getLocation(); p.x = 2; p.y = 13; tracker.listBoxInstruments->setLocation(p); size = tracker.listBoxSamples->getSize(); size.height = listBoxContainerHeight - 15; size.width = screen->getWidth() / 2 - 4; tracker.listBoxSamples->setSize(size); p = tracker.listBoxSamples->getLocation(); p.x = 2 + (screen->getWidth() / 2); p.y = 13; tracker.listBoxSamples->setLocation(p); // samples listbox always visible tracker.listBoxSamples->hide(false); size = ctrl->getSize(); size.height = listBoxContainerHeight; size.width = screen->getWidth(); ctrl->setSize(size); ctrl->setLocation(PPPoint(0,0)); }
void PPSlider::setSize(pp_uint32 size) { PPPoint buttonDownPos, buttonBarPos; PPSize buttonBarSize; if (horizontal) { this->size.height = SLIDERBUTTONHEIGHT; this->size.width = size; buttonDownPos = PPPoint(location.x + size - SLIDERBUTTONWIDTH, location.y); buttonBarPos = PPPoint(location.x + SLIDERBUTTONWIDTH, location.y); buttonBarSize = PPSize((size - SLIDERBUTTONWIDTH*2), SLIDERBUTTONHEIGHT); } else { this->size.width = SLIDERBUTTONWIDTH; this->size.height = size; buttonDownPos = PPPoint(location.x, location.y + size - SLIDERBUTTONHEIGHT); buttonBarPos = PPPoint(location.x, location.y + SLIDERBUTTONHEIGHT); buttonBarSize = PPSize(SLIDERBUTTONWIDTH, (size - SLIDERBUTTONHEIGHT*2)); } backgroundButton->setLocation(location); backgroundButton->setSize(this->size); buttonUp->setLocation(location); buttonDown->setLocation(buttonDownPos); }
void PPGamePoly::reset() { pos = PPPointZero; size = PPPointZero; scale = PPPoint(1,1); origin = PPPointZero; color = PPColor::white(); texOffset = PPPointZero; texTileSize = PPSize(32,32); texTileStride = PPSize(0,0); pat = 0; rotate = 0; flags = 0; blend.set(PPGameBlend_None); }
PPContainer::PPContainer(pp_int32 id, PPScreen* parentScreen, EventListenerInterface* eventListener, const PPPoint& location, const PPSize& size, bool border /* = true */) : PPControl(id, parentScreen, eventListener, location, size), color(&PPUIConfig::getInstance()->getColor(PPUIConfig::ColorContainer)), focusedControl(NULL), lastMouseOverControl(NULL), lastMousePoint(PPPoint(0,0)), caughtControl(NULL), currentlyPressedMouseButtons(0) { this->border = border; backgroundButton = new PPButton(0, parentScreen, NULL, location, size, border, false); backgroundButton->setColor(*color); timerEventControls = new PPSimpleVector<PPControl>(16, false); }
SampleEditorControl::SampleEditorControl(pp_int32 id, PPScreen* parentScreen, EventListenerInterface* eventListener, const PPPoint& location, const PPSize& size, bool border/*= true*/) : PPControl(id, parentScreen, eventListener, location, size), border(border), borderColor(&ourOwnBorderColor), caughtControl(NULL), controlCaughtByLMouseButton(false), controlCaughtByRMouseButton(false), sampleEditor(NULL), xScale(1.0f), minScale(1.0f), selectionStartNew(-1), selectionEndNew(-1), selecting(-1), resizing(0), drawMode(false), selectionTicker(-1), relativeNote(0), offsetFormat(OffsetFormatHex) { // default color backgroundColor.set(0, 0, 0); ourOwnBorderColor.set(192, 192, 192); hScrollbar = new PPScrollbar(0, parentScreen, this, PPPoint(location.x, location.y + size.height - SCROLLBARWIDTH - 1), size.width - 1, true); currentPosition.x = currentPosition.y = -1; currentOffset = -1; startPos = 0; visibleWidth = size.width - 4; visibleHeight = size.height - SCROLLBARWIDTH - 4; scrollDist = (3298*visibleWidth) >> 16; adjustScrollbars(); showMarks = new ShowMark[TrackerConfig::maximumPlayerChannels]; for (pp_int32 i = 0; i < TrackerConfig::maximumPlayerChannels; i++) { showMarks[i].pos = -1; showMarks[i].intensity = 0; showMarks[i].panning = 128; } // build submenu static const char* seperatorStringLarge = "\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4"; static const char* seperatorStringMed = "\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4"; subMenuAdvanced = new PPContextMenu(5, parentScreen, this, PPPoint(0,0), TrackerConfig::colorThemeMain); subMenuAdvanced->setSubMenu(true); subMenuAdvanced->addEntry("Volume boost" PPSTR_PERIODS, MenuCommandIDVolumeBoost); subMenuAdvanced->addEntry("Volume fade" PPSTR_PERIODS, MenuCommandIDVolumeFade); subMenuAdvanced->addEntry("Normalize", MenuCommandIDNormalize); subMenuAdvanced->addEntry(seperatorStringLarge, -1); subMenuAdvanced->addEntry("Backwards", MenuCommandIDReverse); subMenuAdvanced->addEntry("Cross-fade", MenuCommandIDXFade); subMenuAdvanced->addEntry(seperatorStringLarge, -1); subMenuAdvanced->addEntry("Change sign", MenuCommandIDChangeSign); subMenuAdvanced->addEntry("Swap byte order", MenuCommandIDSwapByteOrder); subMenuAdvanced->addEntry(seperatorStringLarge, -1); subMenuAdvanced->addEntry("DC normalize", MenuCommandIDDCNormalize); subMenuAdvanced->addEntry("DC offset" PPSTR_PERIODS, MenuCommandIDDCOffset); subMenuAdvanced->addEntry(seperatorStringLarge, -1); subMenuAdvanced->addEntry("Smooth (rect.)", MenuCommandIDRectangularSmooth); subMenuAdvanced->addEntry("Smooth (tri.)", MenuCommandIDTriangularSmooth); subMenuAdvanced->addEntry("3 Band EQ" PPSTR_PERIODS, MenuCommandIDEQ3Band); subMenuAdvanced->addEntry("10 Band EQ" PPSTR_PERIODS, MenuCommandIDEQ10Band); subMenuAdvanced->addEntry(seperatorStringLarge, -1); subMenuAdvanced->addEntry("Resample" PPSTR_PERIODS, MenuCommandIDResample); subMenuPT = new PPContextMenu(6, parentScreen, this, PPPoint(0,0), TrackerConfig::colorThemeMain); subMenuPT->addEntry("Boost", MenuCommandIDPTBoost); subMenuGenerators = new PPContextMenu(7, parentScreen, this, PPPoint(0,0), TrackerConfig::colorThemeMain); subMenuGenerators->addEntry("Noise" PPSTR_PERIODS, MenuCommandIDGenerateNoise); subMenuGenerators->addEntry("Sine" PPSTR_PERIODS, MenuCommandIDGenerateSine); subMenuGenerators->addEntry("Square" PPSTR_PERIODS, MenuCommandIDGenerateSquare); subMenuGenerators->addEntry("Triangle" PPSTR_PERIODS, MenuCommandIDGenerateTriangle); subMenuGenerators->addEntry("Sawtooth" PPSTR_PERIODS, MenuCommandIDGenerateSawtooth); subMenuGenerators->addEntry("Silence" PPSTR_PERIODS, MenuCommandIDGenerateSilence); // build context menu editMenuControl = new PPContextMenu(4, parentScreen, this, PPPoint(0,0), TrackerConfig::colorThemeMain, true); editMenuControl->addEntry("New", MenuCommandIDNew); editMenuControl->addEntry(seperatorStringMed, -1); editMenuControl->addEntry("Undo", MenuCommandIDUndo); editMenuControl->addEntry("Redo", MenuCommandIDRedo); editMenuControl->addEntry(seperatorStringMed, -1); editMenuControl->addEntry("Cut", MenuCommandIDCut); editMenuControl->addEntry("Copy", MenuCommandIDCopy); editMenuControl->addEntry("Paste", MenuCommandIDPaste); editMenuControl->addEntry("Mix-Paste", MenuCommandIDMixPaste); editMenuControl->addEntry("Crop", MenuCommandIDCrop); editMenuControl->addEntry("Range all", MenuCommandIDSelectAll); editMenuControl->addEntry(seperatorStringMed, -1); editMenuControl->addEntry("Advanced \x10", 0xFFFF, subMenuAdvanced); editMenuControl->addEntry("Protracker \x10", 0xFFFF, subMenuPT); editMenuControl->addEntry("Generators \x10", 0xFFFF, subMenuGenerators); // Create tool handler responder toolHandlerResponder = new ToolHandlerResponder(*this); dialog = NULL; resetLastValues(); }
DialogResample::DialogResample(PPScreen* screen, DialogResponder* responder, pp_int32 id) : PPDialogBase(), count(0), resamplerHelper(new ResamplerHelper()), interpolationType(1), adjustFtAndRelnote(true) { #ifdef __LOWRES__ initDialog(screen, responder, id, "Resample" PPSTR_PERIODS, 290, 142+15+20+16, 26+15, "Ok", "Cancel"); #else initDialog(screen, responder, id, "Resample" PPSTR_PERIODS, 290, 142+20+16, 26, "Ok", "Cancel"); #endif pp_int32 x = getMessageBoxContainer()->getLocation().x; pp_int32 width = getMessageBoxContainer()->getSize().width; pp_int32 x2 = x; pp_int32 y2 = getMessageBoxContainer()->getControlByID(MESSAGEBOX_STATICTEXT_MAIN_CAPTION)->getLocation().y; PPButton* button; y2 +=16; // enter edit field 1 x2 = x + width / 2 - (10*8+35 + 14*8)/2; messageBoxContainerGeneric->addControl(new PPStaticText(0, screen, this, PPPoint(x2, y2+2), "Relative note", true)); x2+=17*8; PPListBox* listBox = new PPListBox(MESSAGEBOX_LISTBOX_VALUE_ONE, screen, this, PPPoint(x2, y2), PPSize(7*8,12), true, true, false); listBox->showSelection(false); listBox->setBorderColor(messageBoxContainerGeneric->getColor()); listBox->setMaxEditSize(8); listBoxes[0] = listBox; messageBoxContainerGeneric->addControl(listBox); button = new PPButton(MESSAGEBOX_BUTTON_INCREASE_VALUEONE, screen, this, PPPoint(x2 + listBox->getSize().width + 2, y2), PPSize(16, 11)); button->setText("+"); messageBoxContainerGeneric->addControl(button); button = new PPButton(MESSAGEBOX_BUTTON_DECREASE_VALUEONE, screen, this, PPPoint(x2 + listBox->getSize().width + 2 + button->getSize().width + 1, y2), PPSize(16, 11)); button->setText("-"); messageBoxContainerGeneric->addControl(button); y2+=16; x2 = x + width / 2 - (10*8+35 + 14*8)/2; messageBoxContainerGeneric->addControl(new PPStaticText(0, screen, this, PPPoint(x2, y2+2), "Fine tune", true)); x2+=17*8; listBox = new PPListBox(MESSAGEBOX_LISTBOX_VALUE_TWO, screen, this, PPPoint(x2, y2), PPSize(7*8,12), true, true, false); listBox->showSelection(false); listBox->setBorderColor(messageBoxContainerGeneric->getColor()); listBox->setMaxEditSize(8); listBoxes[1] = listBox; messageBoxContainerGeneric->addControl(listBox); button = new PPButton(MESSAGEBOX_BUTTON_INCREASE_VALUETWO, screen, this, PPPoint(x2 + listBox->getSize().width + 2, y2), PPSize(16, 11)); button->setText("+"); messageBoxContainerGeneric->addControl(button); button = new PPButton(MESSAGEBOX_BUTTON_DECREASE_VALUETWO, screen, this, PPPoint(x2 + listBox->getSize().width + 2 + button->getSize().width + 1, y2), PPSize(16, 11)); button->setText("-"); messageBoxContainerGeneric->addControl(button); y2+=16; x2 = x + width / 2 - (10*8+35 + 14*8)/2; messageBoxContainerGeneric->addControl(new PPStaticText(0, screen, this, PPPoint(x2, y2+2), "C4 speed (Hz)", true)); x2+=14*8; listBox = new PPListBox(MESSAGEBOX_LISTBOX_VALUE_THREE, screen, this, PPPoint(x2, y2), PPSize(10*8,12), true, true, false); listBox->showSelection(false); listBox->setBorderColor(messageBoxContainerGeneric->getColor()); listBox->setMaxEditSize(8); listBoxes[2] = listBox; messageBoxContainerGeneric->addControl(listBox); button = new PPButton(MESSAGEBOX_BUTTON_INCREASE_VALUETHREE, screen, this, PPPoint(x2 + listBox->getSize().width + 2, y2), PPSize(16, 11)); button->setText("+"); messageBoxContainerGeneric->addControl(button); button = new PPButton(MESSAGEBOX_BUTTON_DECREASE_VALUETHREE, screen, this, PPPoint(x2 + listBox->getSize().width + 2 + button->getSize().width + 1, y2), PPSize(16, 11)); button->setText("-"); messageBoxContainerGeneric->addControl(button); y2+=16; x2 = x + width / 2 - (10*8+35 + 14*8)/2; messageBoxContainerGeneric->addControl(new PPStaticText(0, screen, this, PPPoint(x2, y2+2), "New size:", true)); x2+=18*8; messageBoxContainerGeneric->addControl(new PPStaticText(MESSAGEBOX_STATICTEXT_USER1, screen, this, PPPoint(x2, y2+2), "XXXXXXXX")); y2+=16; x2 = x + width / 2 - (10*8+35 + 14*8)/2; messageBoxContainerGeneric->addControl(new PPStaticText(0, screen, this, PPPoint(x2, y2+2), "Interpolation:", true)); x2+=15*8; button = new PPButton(MESSAGEBOX_CONTROL_USER1, screen, this, PPPoint(x2, y2), PPSize(button->getLocation().x + button->getSize().width - x2, 11), false); button->setText(resamplerHelper->getResamplerName(interpolationType, true)); button->setColor(messageBoxContainerGeneric->getColor()); button->setTextColor(PPUIConfig::getInstance()->getColor(PPUIConfig::ColorStaticText)); messageBoxContainerGeneric->addControl(button); y2+=16; x2 = x + width / 2 - (10*8+35 + 14*8)/2; messageBoxContainerGeneric->addControl(new PPStaticText(0, screen, this, PPPoint(x2, y2+2), "Adjust Ft/Rel.Note:", true)); x2+= 21*8; checkBox = new PPCheckBox(MESSAGEBOX_CONTROL_USER2, screen, this, PPPoint(x2, y2+1)); checkBox->checkIt(adjustFtAndRelnote); messageBoxContainerGeneric->addControl(checkBox); y2+=16; #ifdef __LOWRES__ pp_int32 height = getMessageBoxContainer()->getSize().height; pp_int32 y = getMessageBoxContainer()->getLocation().y; const char buttonTexts[] = {'1','2','3','4','5','6','7','8','9','0','+','-','.','<','>'}; pp_int32 bWidth = (width - 22*2 - 2*3) / sizeof(buttonTexts); pp_int32 x2_2 = x+4; pp_int32 y2_2 = y+height - 4 - 13; messageBoxContainerGeneric->addControl(new PPSeperator(0, screen, PPPoint(x2_2-1, y2_2-3), width-2*3, messageBoxContainerGeneric->getColor(), true)); pp_uint32 i = 0; for (i = 0; i < sizeof(buttonTexts); i++) { button = new PPButton(MESSAGEBOX_BUTTON_KEYS_BASE+i, screen, this, PPPoint(x2_2, y2_2), PPSize(bWidth+1, 13)); button->setText(buttonTexts[i]); messageBoxContainerGeneric->addControl(button); x2_2+=bWidth; } bWidth = 22; button = new PPButton(MESSAGEBOX_BUTTON_KEYS_BASE+i, screen, this, PPPoint(x2_2, y2_2), PPSize(bWidth+1-3, 13)); button->setFont(PPFont::getFont(PPFont::FONT_TINY)); button->setText("Del"); messageBoxContainerGeneric->addControl(button); x2_2+=bWidth-3; i++; button = new PPButton(MESSAGEBOX_BUTTON_KEYS_BASE+i, screen, this, PPPoint(x2_2, y2_2), PPSize(bWidth+1, 13)); button->setFont(PPFont::getFont(PPFont::FONT_TINY)); button->setText("Back"); messageBoxContainerGeneric->addControl(button); #endif currentSelectedListBox = 0; relnote = finetune = 0; c4spd = 0.0f; }
void SectionAbstract::replaceInstrumentListBoxes(bool b, pp_int32 listBoxContainerHeight/* = REPLACEDINSTRUMENTLISTBOXESHEIGHT*/) { PPScreen* screen = tracker.screen; if (b) { tracker.showMainMenu(false, true); tracker.sectionSwitcher->showSubMenu(SectionSwitcher::ActiveLowerSectionPageInstruments, false); screen->getControlByID(CONTAINER_LOWRES_TINYMENU)->show(false); PPContainer* ctrl = static_cast<PPContainer*>(screen->getControlByID(CONTAINER_INSTRUMENTLIST)); oldInstrumentListContainerSize = ctrl->getSize(); oldInstrumentListContainerLocation = ctrl->getLocation(); oldInstrumentListSize = tracker.listBoxInstruments->getSize(); oldInstrumentListLocation = tracker.listBoxInstruments->getLocation(); oldSampleListSize = tracker.listBoxSamples->getSize(); oldSampleListLocation = tracker.listBoxSamples->getLocation(); oldControlLocations[0] = ctrl->getControlByID(BUTTON_INSTRUMENT)->getLocation(); oldControlLocations[1] = ctrl->getControlByID(STATICTEXT_SAMPLEHEADER)->getLocation(); oldControlLocations[2] = ctrl->getControlByID(BUTTON_INSTRUMENTS_PLUS)->getLocation(); oldControlLocations[3] = ctrl->getControlByID(BUTTON_INSTRUMENTS_MINUS)->getLocation(); visibility[0] = ctrl->getControlByID(LISTBOX_INSTRUMENTS)->isHidden(); visibility[1] = ctrl->getControlByID(LISTBOX_SAMPLES)->isHidden(); visibility[2] = ctrl->getControlByID(BUTTON_INSTRUMENT)->isHidden(); visibility[3] = ctrl->getControlByID(STATICTEXT_SAMPLEHEADER)->isHidden(); visibility[4] = ctrl->getControlByID(BUTTON_INSTRUMENTS_PLUS)->isHidden(); visibility[5] = ctrl->getControlByID(BUTTON_INSTRUMENTS_MINUS)->isHidden(); visibility[6] = ctrl->getControlByID(STATICTEXT_INSTRUMENTS_ALTERNATIVEHEADER)->isHidden(); visibility[7] = ctrl->getControlByID(STATICTEXT_INSTRUMENTS_ALTERNATIVEHEADER2)->isHidden(); visibility[8] = ctrl->getControlByID(BUTTON_JAMMENU_NEXTINSTRUMENT)->isHidden(); visibility[9] = ctrl->getControlByID(BUTTON_JAMMENU_PREVINSTRUMENT)->isHidden(); replaceAndResizeInstrumentListContainer(listBoxContainerHeight); // flip button is always hidden ctrl->getControlByID(BUTTON_INSTRUMENTS_FLIP)->hide(true); // so is alternative header ("Samples / Ins:xx") ctrl->getControlByID(STATICTEXT_INSTRUMENTS_ALTERNATIVEHEADER)->hide(true); ctrl->getControlByID(STATICTEXT_INSTRUMENTS_ALTERNATIVEHEADER2)->hide(true); // up/down buttons as well ctrl->getControlByID(BUTTON_JAMMENU_NEXTINSTRUMENT)->hide(true); ctrl->getControlByID(BUTTON_JAMMENU_PREVINSTRUMENT)->hide(true); // instrument button always visible ctrl->getControlByID(BUTTON_INSTRUMENT)->hide(false); ctrl->getControlByID(STATICTEXT_SAMPLEHEADER)->hide(false); // instrument "+" visible ctrl->getControlByID(BUTTON_INSTRUMENTS_PLUS)->hide(false); // instrument "-" visible ctrl->getControlByID(BUTTON_INSTRUMENTS_MINUS)->hide(false); // listbox is always visible tracker.listBoxInstruments->hide(false); // add another button if (ctrl->getControlByID(BUTTON_SAMPLES_INVOKEHDRECORDER) == NULL) { PPPoint p = ctrl->getControlByID(STATICTEXT_SAMPLEHEADER)->getLocation(); p.y = ctrl->getControlByID(BUTTON_INSTRUMENTS_PLUS)->getLocation().y; pp_int32 width = ctrl->getControlByID(STATICTEXT_SAMPLEHEADER)->getSize().width; pp_int32 height = ctrl->getControlByID(BUTTON_INSTRUMENTS_PLUS)->getSize().height; PPButton* button = new PPButton(BUTTON_SAMPLES_INVOKEHDRECORDER, screen, &tracker, PPPoint(p.x + width + 2, p.y), PPSize(7*5, height)); button->setFont(PPFont::getFont(PPFont::FONT_TINY)); button->setText("Render"); ctrl->addControl(button); } else { PPPoint p = ctrl->getControlByID(STATICTEXT_SAMPLEHEADER)->getLocation(); p.y = ctrl->getControlByID(BUTTON_INSTRUMENTS_PLUS)->getLocation().y; pp_int32 width = ctrl->getControlByID(STATICTEXT_SAMPLEHEADER)->getSize().width; pp_int32 height = ctrl->getControlByID(BUTTON_INSTRUMENTS_PLUS)->getSize().height; PPButton* button = static_cast<PPButton*>(ctrl->getControlByID(BUTTON_SAMPLES_INVOKEHDRECORDER)); button->setLocation(PPPoint(p.x + width + 2, p.y)); button->setSize(PPSize(7*5, height)); button->hide(false); } } else { tracker.showMainMenu(true, true); tracker.listBoxInstruments->setSize(oldInstrumentListSize); tracker.listBoxInstruments->setLocation(oldInstrumentListLocation); tracker.listBoxSamples->setSize(oldSampleListSize); tracker.listBoxSamples->setLocation(oldSampleListLocation); PPContainer* ctrl = static_cast<PPContainer*>(screen->getControlByID(CONTAINER_INSTRUMENTLIST)); ctrl->setSize(oldInstrumentListContainerSize); ctrl->setLocation(oldInstrumentListContainerLocation); ctrl->getControlByID(BUTTON_INSTRUMENT)->setLocation(oldControlLocations[0]); ctrl->getControlByID(STATICTEXT_SAMPLEHEADER)->setLocation(oldControlLocations[1]); ctrl->getControlByID(BUTTON_INSTRUMENTS_PLUS)->setLocation(oldControlLocations[2]); ctrl->getControlByID(BUTTON_INSTRUMENTS_MINUS)->setLocation(oldControlLocations[3]); // this is always visible ctrl->getControlByID(BUTTON_INSTRUMENTS_FLIP)->hide(false); // for the rest just restore the old visibility flags ctrl->getControlByID(LISTBOX_INSTRUMENTS)->hide(visibility[0]); ctrl->getControlByID(LISTBOX_SAMPLES)->hide(visibility[1]); ctrl->getControlByID(BUTTON_INSTRUMENT)->hide(visibility[2]); ctrl->getControlByID(STATICTEXT_SAMPLEHEADER)->hide(visibility[3]); ctrl->getControlByID(BUTTON_INSTRUMENTS_PLUS)->hide(visibility[4]); ctrl->getControlByID(BUTTON_INSTRUMENTS_MINUS)->hide(visibility[5]); ctrl->getControlByID(STATICTEXT_INSTRUMENTS_ALTERNATIVEHEADER)->hide(visibility[6]); ctrl->getControlByID(STATICTEXT_INSTRUMENTS_ALTERNATIVEHEADER2)->hide(visibility[7]); ctrl->getControlByID(BUTTON_JAMMENU_NEXTINSTRUMENT)->hide(visibility[8]); ctrl->getControlByID(BUTTON_JAMMENU_PREVINSTRUMENT)->hide(visibility[9]); PPControl* dummy = ctrl->getControlByID(BUTTON_SAMPLES_INVOKEHDRECORDER); if (dummy) dummy->hide(true); } }
EnvelopeEditorControl::EnvelopeEditorControl(pp_int32 id, PPScreen* parentScreen, EventListenerInterface* eventListener, const PPPoint& location, const PPSize& size, bool border/*= true*/) : PPControl(id, parentScreen, eventListener, location, size), borderColor(&ourOwnBorderColor), envelopeEditor(NULL), envelope(NULL), showMarks(NULL) { this->border = border; ourOwnBorderColor.set(192, 192, 192); // default color backgroundColor.set(0, 0, 0); hScrollbar = new PPScrollbar(0, parentScreen, this, PPPoint(location.x, location.y + size.height - SCROLLBARWIDTH - 1), size.width - 1, true); xMax = XMAX; yMax = YMAX; currentPosition.x = currentPosition.y = -1; xScale = 256; showVCenter = false; startPos = 0; visibleWidth = size.width - 5; visibleHeight = size.height - SCROLLBARWIDTH - 5; adjustScrollbars(); caughtControl = NULL; controlCaughtByLMouseButton = controlCaughtByRMouseButton = false; showMarks = new ShowMark[TrackerConfig::maximumPlayerChannels]; clearShowMarks(); // build submenu subMenuAdvanced = new PPContextMenu(5, parentScreen, this, PPPoint(0,0), TrackerConfig::colorThemeMain); subMenuAdvanced->setSubMenu(true); subMenuAdvanced->addEntry("Scale X", MenuCommandIDXScale); subMenuAdvanced->addEntry("Scale Y", MenuCommandIDYScale); // Context PPMenu editMenuControl = new PPContextMenu(4, parentScreen, this, PPPoint(0,0), TrackerConfig::colorThemeMain, true); editMenuControl->addEntry("Undo", MenuCommandIDUndo); editMenuControl->addEntry("Redo", MenuCommandIDRedo); editMenuControl->addEntry("\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4", -1); editMenuControl->addEntry("Copy", MenuCommandIDCopy); editMenuControl->addEntry("Paste", MenuCommandIDPaste); editMenuControl->addEntry("\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4", -1); editMenuControl->addEntry("Advanced \x10", 0xFFFF, subMenuAdvanced); // Create tool handler responder toolHandlerResponder = new ToolHandlerResponder(*this); dialog = NULL; resetLastValues(); }
static SDL_TimerID timer; // Tracker globals static PPScreen* myTrackerScreen = NULL; static Tracker* myTracker = NULL; static PPDisplayDevice* myDisplayDevice = NULL; #ifdef HAVE_LIBASOUND static MidiReceiver* myMidiReceiver = NULL; #endif // Okay what else do we need? PPMutex* globalMutex = NULL; static bool ticking = false; static pp_uint32 lmyTime; static PPPoint llastClickPosition = PPPoint(0,0); static pp_uint16 lClickCount = 0; static pp_uint32 rmyTime; static PPPoint rlastClickPosition = PPPoint(0,0); static pp_uint16 rClickCount = 0; static bool lMouseDown = false; static pp_uint32 lButtonDownStartTime; static bool rMouseDown = false; static pp_uint32 rButtonDownStartTime; static pp_uint32 timerTicker = 0; static PPPoint p;
void SectionTranspose::init(pp_int32 px, pp_int32 py) { pp_int32 i; PPScreen* screen = tracker.screen; // test PPContainer* container = new PPContainer(CONTAINER_TRANSPOSE, tracker.screen, this, PPPoint(px, py), PPSize(320,UPPERLEFTSECTIONHEIGHT), false); container->setColor(TrackerConfig::colorThemeMain); tracker.screen->addControl(container); const pp_int32 buttonIDs[4] = {TRANSPOSE_BUTTON_AMOUNT_NOTEUP, TRANSPOSE_BUTTON_AMOUNT_NOTEDOWN, TRANSPOSE_BUTTON_AMOUNT_OCTAVEUP, TRANSPOSE_BUTTON_AMOUNT_OCTAVEDOWN}; const char* buttonTexts[4] = {"Note Up", "Note Dn", "Octave Up", "Octave Dn"}; const pp_int32 buttonIDs2[4] = {TRANSPOSE_BUTTON_USER1, TRANSPOSE_BUTTON_USER2, TRANSPOSE_BUTTON_USER3, TRANSPOSE_BUTTON_USER4}; const char* buttonTexts2[4] = {"Track", "Pattern", "Song", "Block"}; PPSize size = container->getSize(); /*tracker.showMessageBox(MESSAGEBOX_TRANSPOSE, "Filter options", Tracker::MessageBox_OK, false); PPMessageBoxContainer* container = static_cast<PPMessageBoxContainer*>(screen->getModalControl()); container->setCaption("Transpose"); container->removeControl(container->getControlByID(MESSAGEBOX_BUTTON_YES)); PPSize size = container->getSize(); size.height = 216; PPPoint location = container->getLocation(); location.y = screen->getHeight() / 2 - size.height / 2; container->setLocation(location); container->setSize(size); PPStaticText* text = static_cast<PPStaticText*>(container->getControlByID(1)); ASSERT(text); text->setUnderlined(true); PPPoint location2 = text->getLocation(); location2.y = location.y + 20; location2.x = location.x + 6; text->setLocation(location2); location2 = location;*/ PPStaticText* text; PPPoint location(px,py); PPPoint location2 = location; PPRadioGroup* radioGroup; PPButton* button; // ----------------------- Instrument ---------------------- location2.x += 2; location2.y += 2; text = new PPStaticText(0, NULL, NULL, location2, "Instrument:", true); container->addControl(text); location2.y += 10; PPPoint temp = location2; radioGroup = new PPRadioGroup(2, screen, this, PPPoint(location2.x, location2.y-2), PPSize(8*9, 42)); radioGroup->setColor(TrackerConfig::colorThemeMain); radioGroup->addItem("Single:"); radioGroup->addItem("All"); radioGroup->addItem("Range:"); radioGroup->setChoice(1); container->addControl(radioGroup); // plus minus pp_int32 h = location2.x + 8*9; pp_int32 hy = location2.y + 3; container->addControl(new PPStaticText(TRANSPOSE_TEXT_INS, NULL, NULL, PPPoint(h,hy), "xx", false)); h+=8*2+4; button = new PPButton(TRANSPOSE_BUTTON_INS_PLUS, screen, this, PPPoint(h, hy), PPSize(10, 9)); button->setText(TrackerConfig::stringButtonPlus); container->addControl(button); h+=button->getSize().width; button = new PPButton(TRANSPOSE_BUTTON_INS_MINUS, screen, this, PPPoint(h, hy), PPSize(10, 9)); button->setText(TrackerConfig::stringButtonMinus); container->addControl(button); location2.y += radioGroup->getSize().height; //location2.x +=6*8 + 10; location2.x+=8*2-2; h = location2.x; text = new PPStaticText(TRANSPOSE_TEXT_INS_RANGESTART, NULL, NULL, location2, "From:xx", false); container->addControl(text); location2.x += 8*8-4; button = new PPButton(TRANSPOSE_BUTTON_INS_RANGESTART_PLUS, screen, this, location2, PPSize(10, 9)); button->setText(TrackerConfig::stringButtonPlus); container->addControl(button); location2.x+=button->getSize().width; button = new PPButton(TRANSPOSE_BUTTON_INS_RANGESTART_MINUS, screen, this, location2, PPSize(10, 9)); button->setText(TrackerConfig::stringButtonMinus); container->addControl(button); //location2.x+=button->getSize().width + 2; location2.x = h; location2.y+=11; text = new PPStaticText(TRANSPOSE_TEXT_INS_RANGEEND, NULL, NULL, location2, "To: xx", false); container->addControl(text); location2.x+=8*8-4; button = new PPButton(TRANSPOSE_BUTTON_INS_RANGEEND_PLUS, screen, this, location2, PPSize(10, 9)); button->setText(TrackerConfig::stringButtonPlus); container->addControl(button); location2.x+=button->getSize().width; button = new PPButton(TRANSPOSE_BUTTON_INS_RANGEEND_MINUS, screen, this, location2, PPSize(10, 9)); button->setText(TrackerConfig::stringButtonMinus); container->addControl(button); // ---------------- notes --------------------- location2.x += button->getSize().width + 26; location2.y = location.y + 2; container->addControl(new PPSeperator(0, screen, PPPoint(location2.x-6, location.y+2), (size.height)-42, container->getColor(), false)); text = new PPStaticText(0, NULL, NULL, location2, "Note:", true); container->addControl(text); location2.y += 10; temp = location2; radioGroup = new PPRadioGroup(3, screen, this, PPPoint(location2.x, location2.y-2), PPSize(8*9, 42)); radioGroup->setColor(TrackerConfig::colorThemeMain); radioGroup->addItem("Single:"); radioGroup->addItem("All"); radioGroup->addItem("Range:"); radioGroup->setChoice(1); container->addControl(radioGroup); // plus minus h = location2.x + 8*9; hy = location2.y + 3; container->addControl(new PPStaticText(TRANSPOSE_TEXT_NOTE, NULL, NULL, PPPoint(h,hy), "xxx", false)); h+=8*3+4; button = new PPButton(TRANSPOSE_BUTTON_NOTE_PLUS, screen, this, PPPoint(h, hy), PPSize(10, 9)); button->setText(TrackerConfig::stringButtonPlus); container->addControl(button); h+=button->getSize().width; button = new PPButton(TRANSPOSE_BUTTON_NOTE_MINUS, screen, this, PPPoint(h, hy), PPSize(10, 9)); button->setText(TrackerConfig::stringButtonMinus); container->addControl(button); location2.y += radioGroup->getSize().height; //location2.x +=6*8 + 10; location2.x+=8*2-2; h = location2.x; text = new PPStaticText(TRANSPOSE_TEXT_NOTE_RANGESTART, NULL, NULL, location2, "From:xxx", false); container->addControl(text); location2.x += 8*9-4; button = new PPButton(TRANSPOSE_BUTTON_NOTE_RANGESTART_PLUS, screen, this, location2, PPSize(10, 9)); button->setText(TrackerConfig::stringButtonPlus); container->addControl(button); location2.x+=button->getSize().width; button = new PPButton(TRANSPOSE_BUTTON_NOTE_RANGESTART_MINUS, screen, this, location2, PPSize(10, 9)); button->setText(TrackerConfig::stringButtonMinus); container->addControl(button); //location2.x+=button->getSize().width + 2; location2.x = h; location2.y+=11; text = new PPStaticText(TRANSPOSE_TEXT_NOTE_RANGEEND, NULL, NULL, location2, "To: xxx", false); container->addControl(text); location2.x+=8*9-4; button = new PPButton(TRANSPOSE_BUTTON_NOTE_RANGEEND_PLUS, screen, this, location2, PPSize(10, 9)); button->setText(TrackerConfig::stringButtonPlus); container->addControl(button); location2.x+=button->getSize().width; button = new PPButton(TRANSPOSE_BUTTON_NOTE_RANGEEND_MINUS, screen, this, location2, PPSize(10, 9)); button->setText(TrackerConfig::stringButtonMinus); container->addControl(button); // horizontal ruler location2.y += button->getSize().height+5; container->addControl(new PPSeperator(0, screen, PPPoint(location.x+2, location2.y), size.width-5, container->getColor(), true)); location2.x += button->getSize().width + 26; location2.y = location.y + 4; container->addControl(new PPSeperator(0, screen, PPPoint(location2.x-6, location.y+2), (size.height)-42, container->getColor(), false)); const PPString str = "Amount:"; location2.y-=2; text = new PPStaticText(6, NULL, NULL, location2, str, true); container->addControl(text); const PPString str2 = "-xx"; location2.y+=13; location2.x+=8; text = new PPStaticText(TRANSPOSE_TEXT_AMOUNT, NULL, NULL, location2, str2, false); container->addControl(text); h = location2.x+3*8+4; hy = location2.y; button = new PPButton(TRANSPOSE_BUTTON_AMOUNT_PLUS, screen, this, PPPoint(h, hy), PPSize(10, 9)); button->setText(TrackerConfig::stringButtonPlus); container->addControl(button); h+=button->getSize().width; button = new PPButton(TRANSPOSE_BUTTON_AMOUNT_MINUS, screen, this, PPPoint(h, hy), PPSize(10, 9)); button->setText(TrackerConfig::stringButtonMinus); container->addControl(button); hy+=11; h-=5*8; text = new PPStaticText(TRANSPOSE_TEXT_AMOUNT2, NULL, NULL, PPPoint(h+1, hy), "note(s)", true); container->addControl(text); // preset buttons pp_int32 buttonWidth = 7*8+4; pp_int32 buttonHeight = 9; pp_int32 spacer = 10; pp_int32 y2 = hy+11; pp_int32 x = h-3; for (i = 0; i < 4; i++) { PPButton* button = new PPButton(buttonIDs[i], screen, this, PPPoint(x, y2), PPSize(buttonWidth, buttonHeight)); button->setText(buttonTexts[i]); button->setFont(PPFont::getFont(PPFont::FONT_TINY)); container->addControl(button); y2+= buttonHeight+1; } y2+=10; //container->addControl(new PPSeperator(0, screen, PPPoint(location.x+2, y2), size.width-5, container->getColor(), true)); const PPString str3 = "Apply:"; location2.x = location.x+6; location2.y = y2; text = new PPStaticText(6, NULL, NULL, location2, str3, true); container->addControl(text); buttonWidth = 60; //y2+=14; spacer = 4; buttonHeight = 14; pp_int32 cx = ((buttonWidth) * 4 + (spacer*3))/2; x = location.x + (size.width-6*8)/2 - cx + 6*8 + 2; y2-=3; for (i = 0; i < 4; i++) { PPButton* button = new PPButton(buttonIDs2[i], screen, this, PPPoint(x, y2), PPSize(buttonWidth, buttonHeight)); button->setText(buttonTexts2[i]); container->addControl(button); x+= buttonWidth + spacer; } y2 += buttonHeight+2; container->addControl(new PPSeperator(0, screen, PPPoint(location.x+2, y2), size.width-5, container->getColor(), true)); y2+=4; buttonWidth = 8*4+4; buttonHeight = 11; button = new PPButton(TRANSPOSE_BUTTON_EXIT, screen, this, PPPoint(x-buttonWidth-spacer, y2), PPSize(buttonWidth,buttonHeight)); button->setText("Exit"); container->addControl(button); sectionContainer = container; initialised = true; showSection(false); }
void SectionQuickOptions::init(pp_int32 px, pp_int32 py) { PPCheckBox* checkBox; PPScreen* screen = tracker.screen; if (dialogPanning == NULL) dialogPanning = new DialogPanning(screen, this, TrackerConfig::numPlayerChannels); PPContainer* container = new PPContainer(CONTAINER_QUICKOPTIONS, tracker.screen, this, PPPoint(px, py), PPSize(320,UPPERLEFTSECTIONHEIGHT), false); container->setColor(TrackerConfig::colorThemeMain); tracker.screen->addControl(container); container->addControl(new PPStaticText(0, NULL, NULL, PPPoint(px + 2, py + 2), "Quick Options (experts only)", true, true)); PPSize size = container->getSize(); pp_int32 buttonWidth = 8*4+4; pp_int32 buttonHeight = 11; pp_int32 x = px+container->getSize().width-(buttonWidth+4); pp_int32 y = py+container->getSize().height-(buttonHeight+4); container->addControl(new PPSeperator(0, screen, PPPoint(x - 6, y - 4), 4 + buttonHeight + 3, TrackerConfig::colorThemeMain, false)); container->addControl(new PPSeperator(0, screen, PPPoint(px + 2, y - 4), container->getSize().width - 4, TrackerConfig::colorThemeMain, true)); PPButton* button = new PPButton(QUICKOPTIONS_BUTTON_EXIT, screen, this, PPPoint(x, y), PPSize(buttonWidth,buttonHeight)); button->setText("Exit"); container->addControl(button); pp_int32 x2 = px+4; pp_int32 y2 = py+4+12; y+=2; container->addControl(new PPStaticText(QUICKOPTIONS_STATICTEXT_KEEPOPTIONS, NULL, NULL, PPPoint(x2 + 2, y), "Keep settings (auto-adjust OFF)", true)); checkBoxKeepSettings = new PPCheckBox(QUICKOPTIONS_CHECKBOX_KEEPOPTIONS, screen, this, PPPoint(x2 + 2 + 31*8 + 4, y-1)); checkBoxKeepSettings->checkIt(false); container->addControl(checkBoxKeepSettings); // add playback modes container->addControl(new PPStaticText(0, NULL, NULL, PPPoint(x2, y2), "Playback mode:", true)); y2+=10; PPRadioGroup* radioGroup = new PPRadioGroup(QUICKOPTIONS_RADIOGROUP_PLAYBACKMODE, screen, this, PPPoint(x2+2, y2), PPSize(17*8, 3*14)); radioGroup->setColor(TrackerConfig::colorThemeMain); radioGroup->addItem("Fasttracker 2.x"); radioGroup->addItem("Protracker 2.x"); radioGroup->addItem("Protracker 3.x"); container->addControl(radioGroup); y2+=radioGroup->getSize().height; x2 += radioGroup->getSize().width+6; y2 = py + 16; container->addControl(new PPSeperator(0, screen, PPPoint(x2 - 4, y2 - 2), container->getLocation().y + container->getSize().height - y2 - 17, TrackerConfig::colorThemeMain, false)); y2 = py+4+12; x2+=2; container->addControl(new PPStaticText(0, NULL, NULL, PPPoint(x2, y2), "Advanced:", true)); y2+=15; container->addControl(new PPStaticText(QUICKOPTIONS_STATICTEXT_ALLOW8XX, NULL, NULL, PPPoint(x2, y2), "Allow 8xx panning", true)); checkBox = new PPCheckBox(QUICKOPTIONS_CHECKBOX_ALLOW8XX, screen, this, PPPoint(x2 + 19*8 + 4, y2-1)); container->addControl(checkBox); y2+=13; container->addControl(new PPStaticText(QUICKOPTIONS_STATICTEXT_ALLOWE8X, NULL, NULL, PPPoint(x2, y2), "Allow E8x panning", true)); checkBox = new PPCheckBox(QUICKOPTIONS_CHECKBOX_ALLOWE8X, screen, this, PPPoint(x2 + 19*8 + 4, y2-1)); container->addControl(checkBox); y2+=13; container->addControl(new PPStaticText(QUICKOPTIONS_STATICTEXT_PTPERIODRANGE, NULL, NULL, PPPoint(x2, y2), "PT 3 octaves limit", true)); checkBox = new PPCheckBox(QUICKOPTIONS_CHECKBOX_PTPERIODRANGE, screen, this, PPPoint(x2 + 19*8 + 4, y2-1)); container->addControl(checkBox); y2+=13; container->addControl(new PPStaticText(QUICKOPTIONS_STATICTEXT_SETDEFAULTPANNING, NULL, NULL, PPPoint(x2, y2), "Default panning", true)); button = new PPButton(QUICKOPTIONS_BUTTON_SETDEFAULTPANNING, screen, this, PPPoint(x2 + 19*8 - 18, y2-1), PPSize(4*8,buttonHeight)); button->setText("Set"); container->addControl(button); sectionContainer = container; initialised = true; showSection(false); }