Changeset 1328
- Timestamp:
- 12/27/07 22:34:45 (8 months ago)
- Location:
- trunk/src/buzelib
- Files:
-
- 4 modified
-
MainFrm.cpp (modified) (1 diff)
-
PreferencesView.cpp (modified) (3 diffs)
-
PreferencesViewProperties.cpp (modified) (8 diffs)
-
PreferencesViewProperties.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/buzelib/MainFrm.cpp
r1326 r1328 583 583 584 584 LRESULT CMainFrame::OnShowPreferences(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { 585 586 585 showPreferencesView(); 587 586 588 CPreferencesDialog prefs(this);589 prefs.DoModal();587 //CPreferencesDialog prefs(this); 588 //prefs.DoModal(); 590 589 return 0; 591 590 } -
trunk/src/buzelib/PreferencesView.cpp
r1326 r1328 14 14 :CViewImpl<CMainFrame, CDocument, CPreferencesView>(mainFrm->document) 15 15 { 16 mainFrame = mainFrm; 16 17 lastPageListItem = -1; 18 provider = 0; 17 19 } 18 20 … … 51 53 pLoop->AddIdleHandler(this); 52 54 55 mainFrame->addTabableView(m_hWnd); 56 53 57 return lres; 54 58 } 55 59 56 60 LRESULT CPreferencesView::OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { 61 document->removeView(this); 62 63 // denne fixet crash når vi lukker hele clienten 64 mainFrame->closeClientWindow(const_cast<ClientView*>(mainFrame->get(m_hWnd))); 57 65 58 66 CMessageLoop* pLoop = _Module.GetMessageLoop(); … … 92 100 93 101 LRESULT CPreferencesView::OnApplyClicked(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { 94 MessageBox("Apply!");102 provider->doDataExchange(true); 95 103 return 0; 96 104 } -
trunk/src/buzelib/PreferencesViewProperties.cpp
r1326 r1328 101 101 inDeviceIndex = 0; else 102 102 inDeviceIndex = (i - names.begin()) + 1; 103 dirty = false; 103 104 } else { 104 105 105 //zzub::audiodevice* device = out_devices[outDeviceIndex]; 106 //rate = device->rates[rateIndex]; 107 108 //mainFrame->configuration->setAudioDriver(outDevice, inDevice, rate, size, outch); 106 zzub::audiodevice* out_device = out_devices[outDeviceIndex]; 107 108 zzub::audiodevice* in_device = 0; 109 if (inDeviceIndex > 0) in_device = in_devices[inDeviceIndex - 1]; 110 111 std::string outDevice = out_device->name; 112 std::string inDevice = ""; 113 if (in_device) inDevice = in_device->name; 114 int rate = out_device->rates[rateIndex]; 115 int size = standardBufferSizes[bufferSizeIndex]; 116 117 _Module.setAudioDriver(outDevice, inDevice, rate, size, outChannelIndex, true); 118 dirty = false; 109 119 110 120 } … … 368 378 369 379 _Module.configuration->setMidiOutputs(midiIndices); 380 dirty = false; 370 381 } 371 382 } … … 488 499 COLORREF color = _Module.themes->getThemeColor(name); 489 500 return color; 490 /*std::stringstream strm;491 strm << "#" << std::hex << std::setw(6) << std::setfill('0') << std::uppercase << color;492 return strm.str();*/493 501 } 494 502 … … 525 533 properties.push_back(new StringPropertyInfo<CGuiConfigProvider>(this, "Default Wave Editor", &CGuiConfigProvider::getExternalWaveEditor, &CGuiConfigProvider::setExternalWaveEditor)); 526 534 535 fontIndex = -1; 536 fontSizeIndex = -1; 537 zoomIndex = -1; 527 538 } 528 539 … … 540 551 } 541 552 553 void CGuiConfigProvider::doDataExchange(bool save) { 554 if (!save) { 555 float scale = (_Module.configuration->getMachineScale() - 0.1f) * 10.0f; 556 zoomIndex = (int)floor(scale + 0.5f); 557 machineSkins = _Module.configuration->getMachineSkinVisibility(); 558 559 std::string fontName = ""; 560 _Module.configuration->getConfigString("Settings", "FixedWidthFont", &fontName); 561 std::vector<std::string> fonts = getFonts(); 562 std::vector<std::string>::iterator i = find(fonts.begin(), fonts.end(), fontName); 563 if (i == fonts.end()) 564 fontIndex = 0; else 565 fontIndex = i - fonts.begin(); 566 567 int pointsize = 15; 568 _Module.configuration->getConfigNumber("Settings", "FixedWidthFontSize", (DWORD*)&pointsize); 569 std::string ptstr = stringFromInt(pointsize); 570 std::vector<std::string> sizes = getFontSizes(); 571 i = find(sizes.begin(), sizes.end(), ptstr); 572 if (i == sizes.end()) 573 fontSizeIndex = 0; else 574 fontSizeIndex = i - sizes.begin(); 575 576 patternLength = _Module.configuration->getGlobalPatternLength(); 577 578 seqDark = _Module.configuration->getSequencerStepHigh(); 579 seqDarker = _Module.configuration->getSequencerStepLow(); 580 581 seqCellWidth = 64; 582 _Module.configuration->getConfigNumber("Settings", "SequenceCellWidth", (DWORD*)&seqCellWidth); 583 584 paramPopup = _Module.configuration->getParameterPopupFlag()?TRUE:FALSE; 585 waveEditor = _Module.configuration->getExternalWaveEditor(); 586 dirty = false; 587 } else { 588 _Module.configuration->setMachineScale( (double)zoomIndex / 10 + 0.1); 589 _Module.configuration->setMachineSkinVisibility(machineSkins); 590 591 std::vector<std::string> fonts = getFonts(); 592 _Module.configuration->setConfigString("Settings", "FixedWidthFont", fonts[fontIndex]); 593 594 int font = getFont(); 595 int pointsize = fixedWidthSizes[font][fontSizeIndex]; 596 _Module.configuration->setConfigNumber("Settings", "FixedWidthFontSize", (DWORD)pointsize); 597 598 _Module.configuration->setGlobalPatternLength(patternLength); 599 600 _Module.configuration->setSequencerStepLow(seqDarker); 601 _Module.configuration->setSequencerStepHigh(seqDark); 602 603 _Module.configuration->setConfigNumber("Settings", "SequenceCellWidth", (DWORD)seqCellWidth); 604 605 _Module.configuration->setParameterPopupFlag(paramPopup); 606 _Module.configuration->setExternalWaveEditor(waveEditor); 607 dirty = false; 608 609 } 610 } 611 542 612 int CGuiConfigProvider::getZoom() { 543 float scale = (_Module.configuration->getMachineScale() - 0.1f) * 10.0f; 544 return (int)floor(scale + 0.5f); 613 return zoomIndex; 545 614 } 546 615 547 616 void CGuiConfigProvider::setZoom(int i) { 548 617 dirty = true; 549 _Module.configuration->setMachineScale( (double)i / 10 + 0.1);618 zoomIndex = i; 550 619 } 551 620 … … 563 632 564 633 BOOL CGuiConfigProvider::getMachineSkins() { 565 return _Module.configuration->getMachineSkinVisibility()?FALSE:TRUE; 634 // note we return the opposite result 635 return machineSkins?FALSE:TRUE; 566 636 } 567 637 568 638 void CGuiConfigProvider::setMachineSkins(BOOL value) { 569 639 dirty = true; 570 _Module.configuration->setMachineSkinVisibility(value!=0?false:true); 640 // note we set the opposite value 641 machineSkins = value?false:true; 571 642 } 572 643 573 644 int CGuiConfigProvider::getFont() { 574 std::string fontName = ""; 575 _Module.configuration->getConfigString("Settings", "FixedWidthFont", &fontName); 576 577 std::vector<std::string> fonts = getFonts(); 578 std::vector<std::string>::iterator i = find(fonts.begin(), fonts.end(), fontName); 579 if (i == fonts.end()) return 0; 580 581 return i - fonts.begin(); 645 return fontIndex; 582 646 } 583 647 584 648 void CGuiConfigProvider::setFont(int index) { 585 649 dirty = true; 586 std::vector<std::string> fonts = getFonts(); 587 _Module.configuration->setConfigString("Settings", "FixedWidthFont", fonts[index]); 588 650 fontIndex = index; 589 651 view->BindProvider(); 590 652 } … … 688 750 689 751 int CGuiConfigProvider::getFontSize() { 690 int pointsize = 15; 691 _Module.configuration->getConfigNumber("Settings", "FixedWidthFontSize", (DWORD*)&pointsize); 692 693 std::string ptstr = stringFromInt(pointsize); 694 std::vector<std::string> sizes = getFontSizes(); 695 std::vector<std::string>::iterator i = find(sizes.begin(), sizes.end(), ptstr); 696 if (i == sizes.end()) return 0; 697 return i - sizes.begin(); 752 return fontSizeIndex; 698 753 } 699 754 700 755 void CGuiConfigProvider::setFontSize(int index) { 701 756 dirty = true; 702 int font = getFont(); 703 int pointsize = fixedWidthSizes[font][index]; 704 _Module.configuration->setConfigNumber("Settings", "FixedWidthFontSize", (DWORD)pointsize); 757 fontSizeIndex = index; 705 758 } 706 759 … … 721 774 722 775 int CGuiConfigProvider::getPatternLength() { 723 return _Module.configuration->getGlobalPatternLength();776 return patternLength; 724 777 } 725 778 726 779 void CGuiConfigProvider::setPatternLength(int value) { 727 780 dirty = true; 728 _Module.configuration->setGlobalPatternLength(value); 729 view->BindProvider(); 730 } 731 781 patternLength = value; 782 } 732 783 733 784 int CGuiConfigProvider::getSequencerDarkRow() { 734 return _Module.configuration->getSequencerStepHigh();785 return seqDark; 735 786 } 736 787 737 788 void CGuiConfigProvider::setSequencerDarkRow(int value) { 738 789 dirty = true; 739 _Module.configuration->setSequencerStepHigh(value);790 seqDark = value; 740 791 } 741 792 742 793 int CGuiConfigProvider::getSequencerDarkerRow() { 743 return _Module.configuration->getSequencerStepLow();794 return seqDarker; 744 795 } 745 796 746 797 void CGuiConfigProvider::setSequencerDarkerRow(int value) { 747 798 dirty = true; 748 _Module.configuration->setSequencerStepLow(value);799 seqDarker = value; 749 800 } 750 801 751 802 int CGuiConfigProvider::getSequencerCellWidth() { 752 int cellWidth = 64; 753 _Module.configuration->getConfigNumber("Settings", "SequenceCellWidth", (DWORD*)&cellWidth); 754 return cellWidth; 803 return seqCellWidth; 755 804 } 756 805 757 806 void CGuiConfigProvider::setSequencerCellWidth(int cellWidth) { 758 807 dirty = true; 759 _Module.configuration->setConfigNumber("Settings", "SequenceCellWidth", (DWORD)cellWidth);808 seqCellWidth = cellWidth; 760 809 } 761 810 762 811 BOOL CGuiConfigProvider::getParameterPopup() { 763 return _Module.configuration->getParameterPopupFlag()?TRUE:FALSE;812 return paramPopup?TRUE:FALSE; 764 813 } 765 814 766 815 void CGuiConfigProvider::setParameterPopup(BOOL value) { 767 816 dirty = true; 768 _Module.configuration->setParameterPopupFlag(value!=0?true:false);817 paramPopup = value?true:false; 769 818 } 770 819 771 820 std::string CGuiConfigProvider::getExternalWaveEditor() { 772 return _Module.configuration->getExternalWaveEditor();821 return waveEditor; 773 822 } 774 823 775 824 void CGuiConfigProvider::setExternalWaveEditor(std::string value) { 776 825 dirty = true; 777 _Module.configuration->setExternalWaveEditor(value);826 waveEditor = value; 778 827 } 779 828 -
trunk/src/buzelib/PreferencesViewProperties.h
r1326 r1328 28 28 std::vector<PropertyInfoBase*> properties; 29 29 30 // std::string outDevice, inDevice;31 30 int outDeviceIndex, inDeviceIndex; 32 31 int rateIndex, bufferSizeIndex, outChannelIndex; 33 // int rate, size, outch;34 32 35 33 std::vector<zzub::audiodevice*> out_devices; … … 118 116 CThemeConfigProvider* provider; 119 117 std::string name; 118 COLORREF value; 120 119 121 120 void setValue(COLORREF value); 122 121 COLORREF getValue(); 123 // void setValue(std::string value);124 // std::string getValue();125 122 }; 126 123 … … 158 155 CMainFrame* mainFrame; 159 156 std::vector<PropertyInfoBase*> properties; 157 int zoomIndex, fontIndex, fontSizeIndex, patternLength, seqDark, seqDarker, seqCellWidth; 158 bool machineSkins, paramPopup; 159 std::string waveEditor; 160 160 161 161 CGuiConfigProvider(CPropertyView* view, CMainFrame* mainFrame); … … 163 163 virtual PropertyInfoBase* getProperty(int index); 164 164 virtual bool isData(void* data); 165 virtual void doDataExchange(bool save) {}165 virtual void doDataExchange(bool save); 166 166 167 167 std::string getGui() { return "..."; }
