Changeset 1313
- Timestamp:
- 11/13/07 01:50:24 (11 months ago)
- Location:
- trunk/src/buzelib
- Files:
-
- 8 modified
-
BuzeConfiguration.cpp (modified) (2 diffs)
-
BuzeConfiguration.h (modified) (2 diffs)
-
MachineView.cpp (modified) (3 diffs)
-
MainFrm.cpp (modified) (3 diffs)
-
MainFrm.h (modified) (2 diffs)
-
PatternView.cpp (modified) (2 diffs)
-
Preferences/AudioDriverPreferencesView.cpp (modified) (1 diff)
-
buze.rc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/buzelib/BuzeConfiguration.cpp
r1307 r1313 325 325 } 326 326 327 void CConfiguration::setMachineSkinVisibility( std::string uri,bool state) {327 void CConfiguration::setMachineSkinVisibility(bool state) { 328 328 setConfigNumber("Settings", "MachineSkin", state?1:0); 329 329 } 330 330 331 bool CConfiguration::getMachineSkinVisibility( std::string uri) {331 bool CConfiguration::getMachineSkinVisibility() { 332 332 DWORD dw = 1; 333 333 getConfigNumber("Settings", "MachineSkin", &dw); … … 354 354 return dw; 355 355 } 356 357 void CConfiguration::setMachineScale(double sc) { 358 std::string str; 359 char pc[10]; 360 sprintf(pc, "%.6f", sc); 361 str = pc; 362 setConfigString("Settings", "MachineScale", str); 363 } 364 365 double CConfiguration::getMachineScale() { 366 string str; 367 if (!getConfigString("Settings", "MachineScale", &str)) 368 return 1.0; 369 return atof(str.c_str()); 370 } -
trunk/src/buzelib/BuzeConfiguration.h
r1307 r1313 54 54 int getMachinePatternLength(std::string uri); 55 55 56 void setMachineSkinVisibility( std::string uri,bool state);57 bool getMachineSkinVisibility( std::string uri);56 void setMachineSkinVisibility(bool state); 57 bool getMachineSkinVisibility(); 58 58 59 59 void setExternalWaveEditor(std::string cmd); … … 65 65 int getSequencerStepLow(); 66 66 67 void setMachineScale(double sc); 68 double getMachineScale(); 67 69 68 70 }; -
trunk/src/buzelib/MachineView.cpp
r1312 r1313 49 49 mbuttonState = false; 50 50 isLButtonDown = false; 51 scale = 1.0;51 scale = _Module.configuration->getMachineScale(); 52 52 moveType = MachineViewMoveNothing; 53 53 SetRect(&prevDragRect, -1, -1, -1, -1); … … 170 170 171 171 LRESULT CMachineView::OnFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { 172 scale = _Module.configuration->getMachineScale(); 172 173 mainFrame->setCurrentFocus(m_hWnd); 173 174 moveType = MachineViewMoveNothing; … … 1723 1724 1724 1725 1726 -
trunk/src/buzelib/MainFrm.cpp
r1312 r1313 1603 1603 } 1604 1604 1605 LRESULT CMainFrame::saveFile(std::string filename) { 1606 char tempPath[MAX_PATH]; 1607 char tempFile[MAX_PATH]; 1608 GetTempPath(MAX_PATH, tempPath); 1609 GetTempFileName(tempPath, "3zE", 0, tempFile); 1610 debug("Save temporary " + (std::string)tempFile); 1611 1612 bool state = false; 1613 string ext = ""; 1614 size_t lp = filename.find_last_of('.'); 1615 if (lp!=string::npos) { 1616 ext = filename.substr(lp+1); 1617 transform(ext.begin(), ext.end(), ext.begin(), tolower); 1618 } 1619 if (ext=="bmx" || ext=="bmw") { 1620 zzub::file_outstream outf; 1621 1622 state = outf.create(tempFile); 1623 if (state) { 1624 BuzzWriter writer(&outf); 1625 state = writer.writePlayer(player, vector<metaplugin*>(), true); 1626 outf.close(); 1627 } 1628 } else { 1629 CcmWriter writer; 1630 state = writer.save(tempFile, player); 1631 } 1632 1633 if (state) { 1634 debug("Delete original " + filename); 1635 1636 if (PathFileExists(filename.c_str())) 1637 state = DeleteFile(filename.c_str()) != 0; 1638 1639 debug("Rename temporary to original"); 1640 if (state) { 1641 state = MoveFile(tempFile, filename.c_str()); 1642 } 1643 1644 debug("Delete temporary"); 1645 DeleteFile(tempFile); 1646 } 1647 1648 if (state) { 1649 // update window text 1650 document->setCurrentFile(filename); 1651 setWindowTitle(document->currentFileName.c_str()); 1652 document->lastSaveUndoPosition=document->undoManager.getPosition(); 1653 setMostRecent(filename); 1654 } else { 1655 MessageBox("Cannot save file!", filename.c_str()); 1656 debug("Save failed!"); 1657 } 1658 1659 return 0; 1660 } 1661 1605 1662 LRESULT CMainFrame::OnFileSave(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& bHandled) { 1606 return OnFileSaveAs(0, 0, 0, bHandled); 1663 if(document->currentFileName.size() && document->currentFileName != "Untitled") 1664 return saveFile(document->currentDirectory + "\\" + document->currentFileName + "." + document->currentExtension); 1665 else 1666 return OnFileSaveAs(0, 0, 0, bHandled); 1607 1667 } 1608 1668 1609 1669 LRESULT CMainFrame::OnFileSaveAs(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { 1670 1610 1671 OPENFILENAME ofn; // common dialog box structure 1611 1672 char szFile[260]; // buffer for file name … … 1639 1700 if (GetSaveFileName(&ofn)!=TRUE) return 1; 1640 1701 1641 string filename = ofn.lpstrFile; 1642 string ext = ""; 1643 size_t lp = filename.find_last_of('.'); 1644 if (lp!=string::npos) { 1645 ext = filename.substr(lp+1); 1646 transform(ext.begin(), ext.end(), ext.begin(), tolower); 1647 } 1648 1649 char tempPath[MAX_PATH]; 1650 char tempFile[MAX_PATH]; 1651 GetTempPath(MAX_PATH, tempPath); 1652 GetTempFileName(tempPath, "3zE", 0, tempFile); 1653 debug("Save temporary " + (std::string)tempFile); 1654 1655 bool state = false; 1656 if (ext=="bmx" || ext=="bmw") { 1657 zzub::file_outstream outf; 1658 1659 state = outf.create(tempFile); 1660 if (state) { 1661 BuzzWriter writer(&outf); 1662 state = writer.writePlayer(player, vector<metaplugin*>(), true); 1663 outf.close(); 1664 } 1665 } else { 1666 CcmWriter writer; 1667 state = writer.save(tempFile, player); 1668 } 1669 1670 if (state) { 1671 debug("Delete original " + (std::string)ofn.lpstrFile); 1672 1673 if (PathFileExists(ofn.lpstrFile)) 1674 state = DeleteFile(ofn.lpstrFile) != 0; 1675 1676 debug("Rename temporary to original"); 1677 if (state) { 1678 state = MoveFile(tempFile, ofn.lpstrFile); 1679 } 1680 1681 debug("Delete temporary"); 1682 DeleteFile(tempFile); 1683 } 1684 1685 if (state) { 1686 // update window text 1687 document->setCurrentFile(ofn.lpstrFile); 1688 setWindowTitle(document->currentFileName.c_str()); 1689 document->lastSaveUndoPosition=document->undoManager.getPosition(); 1690 } else { 1691 MessageBox("Cannot save file!", ofn.lpstrFile); 1692 debug("Save failed!"); 1693 } 1694 1695 return 0; 1702 return saveFile(ofn.lpstrFile); 1696 1703 } 1697 1704 … … 2753 2760 2754 2761 MachineSkin* CMainFrame::getSkin(std::string uri) { 2755 if (!_Module.configuration->getMachineSkinVisibility( uri)) return 0; // Skin visibility setting2762 if (!_Module.configuration->getMachineSkinVisibility()) return 0; // Skin visibility setting 2756 2763 2757 2764 map<string, MachineSkin>::iterator i = skins.find(uri); -
trunk/src/buzelib/MainFrm.h
r1312 r1313 498 498 bool openSongFromFile(bool clearAll); 499 499 bool openSongFromFile(std::string fileName, bool clearAll); 500 LRESULT saveFile(std::string filename); 500 501 501 502 void updateTick(); … … 667 668 mainFrame = 0; 668 669 } 669 std::string serialize() { 670 char pc[64]; 671 sprintf(pc, "%.6f", data->scale); 672 return pc; 673 } 670 std::string serialize() { return ""; } 674 671 CMachineView* deserialize(std::string str) { 675 CMachineView* view = new CMachineView(mainFrame, mainFrame); 676 double scale = atof(str.c_str()); 677 if (scale != 0.0) 678 view->scale = scale; 672 CMachineView* view = new CMachineView(mainFrame, mainFrame); 679 673 return view; 680 674 } -
trunk/src/buzelib/PatternView.cpp
r1312 r1313 28 28 { 12, 3 }, 29 29 { 12, 4 }, 30 { 16, 3 }, 30 31 { 16, 4 }, 31 32 { 16, 8 }, … … 33 34 { 18, 6 }, 34 35 { 18, 9 }, 36 { 24, 4 }, 37 { 24, 6 }, 38 { 24, 8 }, 35 39 }; 36 40 -
trunk/src/buzelib/Preferences/AudioDriverPreferencesView.cpp
r1292 r1313 174 174 int nearest = -1; 175 175 int nearestDist = UINT_MAX; 176 for (int i = 0; device->rates.size(); i++) {176 for (int i = 0; i < device->rates.size(); i++) { 177 177 unsigned int testRate = device->rates[i]; 178 178 if (testRate == 0) break; -
trunk/src/buzelib/buze.rc
r1307 r1313 168 168 MENUITEM "&New\tCtrl+N", ID_FILE_NEW 169 169 MENUITEM "&Open...\tCtrl+O", ID_FILE_OPEN 170 MENUITEM "&Save As\tCtrl+S",ID_FILE_SAVE170 MENUITEM "&Save\tCtrl+S", ID_FILE_SAVE 171 171 MENUITEM "Save &As...", ID_FILE_SAVE_AS 172 172 MENUITEM SEPARATOR … … 1246 1246 1247 1247 1248
