Changeset 1323
- Timestamp:
- 12/27/07 01:58:56 (10 months ago)
- Location:
- trunk/src/buzelib
- Files:
-
- 2 added
- 8 modified
-
BuzeConfiguration.cpp (modified) (1 diff)
-
MachineView.cpp (modified) (2 diffs)
-
MainFrm.cpp (modified) (8 diffs)
-
MainFrm.h (modified) (2 diffs)
-
PatternView.cpp (modified) (2 diffs)
-
SequenceEditor.cpp (modified) (4 diffs)
-
Utils/ThemeManager.cpp (added)
-
Utils/ThemeManager.h (added)
-
buze.cpp (modified) (2 diffs)
-
buze.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/buzelib/BuzeConfiguration.cpp
r1318 r1323 176 176 177 177 std::string CConfiguration::getTheme() { 178 string theme; 179 if (!getConfigString("Settings", "Theme", &theme)) 180 return ""; 178 string theme = "<default>"; 179 getConfigString("Settings", "Theme", &theme); 181 180 return theme; 182 181 } -
trunk/src/buzelib/MachineView.cpp
r1321 r1323 14 14 #include "../libzzub/bmxwriter.h" 15 15 #include "Utils/utils.h" 16 #include "Utils/ThemeManager.h" 16 17 #include <iomanip> 17 18 #include <strstream> … … 94 95 if (linePen) linePen.DeleteObject(); 95 96 96 masterBgBrush.CreateSolidBrush( mainFrame->getThemeColor("MV Master"));97 masterLedOnBrush.CreateSolidBrush( mainFrame->getThemeColor("MV Master LED On"));98 masterLedOffBrush.CreateSolidBrush( mainFrame->getThemeColor("MV Master LED Off"));99 100 generatorBgBrush.CreateSolidBrush( mainFrame->getThemeColor("MV Generator"));101 generatorMuteBrush.CreateSolidBrush( mainFrame->getThemeColor("MV Generator Mute"));102 generatorPanBrush.CreateSolidBrush( mainFrame->getThemeColor("MV Generator Pan BG"));103 generatorLedOnBrush.CreateSolidBrush( mainFrame->getThemeColor("MV Generator LED On"));104 generatorLedOffBrush.CreateSolidBrush( mainFrame->getThemeColor("MV Generator LED Off"));105 106 effectBgBrush.CreateSolidBrush( mainFrame->getThemeColor("MV Effect"));107 effectMuteBrush.CreateSolidBrush( mainFrame->getThemeColor("MV Effect Mute"));108 effectPanBrush.CreateSolidBrush( mainFrame->getThemeColor("MV Effect Pan BG"));109 effectLedOnBrush.CreateSolidBrush( mainFrame->getThemeColor("MV Generator LED On"));110 effectLedOffBrush.CreateSolidBrush( mainFrame->getThemeColor("MV Generator LED Off"));111 112 backgroundColor = mainFrame->getThemeColor("MV Background");113 114 borderPen.CreatePen(PS_SOLID, 1, mainFrame->getThemeColor("MV Machine Border"));115 linePen.CreatePen(PS_SOLID, 1, mainFrame->getThemeColor("MV Line"));116 117 panHandleBrush.CreateSolidBrush( mainFrame->getThemeColor("MV Pan Handle"));118 arrowBrush.CreateSolidBrush( mainFrame->getThemeColor("MV Arrow"));119 ampBgBrush.CreateSolidBrush( mainFrame->getThemeColor("MV Amp BG"));120 ampHandleBrush.CreateSolidBrush( mainFrame->getThemeColor("MV Amp Handle"));97 masterBgBrush.CreateSolidBrush(_Module.themes->getThemeColor("MV Master")); 98 masterLedOnBrush.CreateSolidBrush(_Module.themes->getThemeColor("MV Master LED On")); 99 masterLedOffBrush.CreateSolidBrush(_Module.themes->getThemeColor("MV Master LED Off")); 100 101 generatorBgBrush.CreateSolidBrush(_Module.themes->getThemeColor("MV Generator")); 102 generatorMuteBrush.CreateSolidBrush(_Module.themes->getThemeColor("MV Generator Mute")); 103 generatorPanBrush.CreateSolidBrush(_Module.themes->getThemeColor("MV Generator Pan BG")); 104 generatorLedOnBrush.CreateSolidBrush(_Module.themes->getThemeColor("MV Generator LED On")); 105 generatorLedOffBrush.CreateSolidBrush(_Module.themes->getThemeColor("MV Generator LED Off")); 106 107 effectBgBrush.CreateSolidBrush(_Module.themes->getThemeColor("MV Effect")); 108 effectMuteBrush.CreateSolidBrush(_Module.themes->getThemeColor("MV Effect Mute")); 109 effectPanBrush.CreateSolidBrush(_Module.themes->getThemeColor("MV Effect Pan BG")); 110 effectLedOnBrush.CreateSolidBrush(_Module.themes->getThemeColor("MV Generator LED On")); 111 effectLedOffBrush.CreateSolidBrush(_Module.themes->getThemeColor("MV Generator LED Off")); 112 113 backgroundColor = _Module.themes->getThemeColor("MV Background"); 114 115 borderPen.CreatePen(PS_SOLID, 1, _Module.themes->getThemeColor("MV Machine Border")); 116 linePen.CreatePen(PS_SOLID, 1, _Module.themes->getThemeColor("MV Line")); 117 118 panHandleBrush.CreateSolidBrush(_Module.themes->getThemeColor("MV Pan Handle")); 119 arrowBrush.CreateSolidBrush(_Module.themes->getThemeColor("MV Arrow")); 120 ampBgBrush.CreateSolidBrush(_Module.themes->getThemeColor("MV Amp BG")); 121 ampHandleBrush.CreateSolidBrush(_Module.themes->getThemeColor("MV Amp Handle")); 121 122 122 123 dirtyBackground = true; -
trunk/src/buzelib/MainFrm.cpp
r1318 r1323 27 27 28 28 #include "Utils/utils.h" 29 #include "Utils/ThemeManager.h" 29 30 #include "../libzzub/archive.h" 30 31 #include "../libzzub/bmxreader.h" … … 2549 2550 LRESULT CMainFrame::OnSetTheme(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { 2550 2551 int themeIndex = wID - ID_SET_THEME_FIRST; 2551 setTheme(getThemeName(themeIndex)); 2552 std::string themeName = _Module.themes->getThemeName(themeIndex); 2553 setTheme(themeName); 2552 2554 return 0; 2553 2555 } … … 2785 2787 LRESULT CMainFrame::OnMeasureItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { 2786 2788 LPMEASUREITEMSTRUCT lpMeasureItem = (LPMEASUREITEMSTRUCT)lParam; 2787 //MachineSeparator& msep = *(MachineSeparator*)lpMeasureItem->itemData; 2788 2789 MachineMenuItem* item = (MachineMenuItem*)lpMeasureItem->itemData;//plur.getItem(msep.identifier); 2789 MachineMenuItem* item = (MachineMenuItem*)lpMeasureItem->itemData; 2790 2790 2791 2791 lpMeasureItem->itemWidth = item->style->headerWidth; … … 2797 2797 LRESULT CMainFrame::OnDrawItem(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/) { 2798 2798 LPDRAWITEMSTRUCT lpDrawItem = (LPDRAWITEMSTRUCT)lParam; 2799 //MachineSeparator& msep = *(MachineSeparator*)lpDrawItem->itemData;2800 2801 //MachineMenuItem* item = plur.getItem(msep.identifier);2802 2799 MachineMenuItem* item = (MachineMenuItem*)lpDrawItem->itemData; 2803 2804 2800 plur.drawItem(lpDrawItem, item); 2805 2806 2801 return 0; 2807 2802 } … … 2814 2809 2815 2810 // themes 2816 2817 struct default_theme_type {2818 const char* name;2819 COLORREF color;2820 };2821 2822 default_theme_type defaultTheme[] = {2823 { "MV Amp BG", RGB(0xAA, 0xAA, 0xAA) },2824 { "MV Amp Handle", RGB(0x00, 0x00, 0x00) },2825 { "MV Arrow", RGB(0xC8, 0xC8, 0xC8) },2826 { "MV Background", RGB(0xDA, 0xD6, 0xC9) },2827 { "MV Effect", RGB(0xC7, 0xAD, 0xA9) },2828 { "MV Effect LED Off", RGB(0x64, 0x1E, 0x1E) },2829 { "MV Effect LED On", RGB(0xFF, 0x64, 0x64) },2830 { "MV Effect Mute", RGB(0x9F, 0x8A, 0x87) },2831 { "MV Effect Pan BG", RGB(0x92, 0x65, 0x5F) },2832 { "MV Generator", RGB(0xA9, 0xAE, 0xC7) },2833 { "MV Generator LED Off", RGB(0x28, 0x28, 0x8C) },2834 { "MV Generator LED On", RGB(0x64, 0x64, 0xFF) },2835 { "MV Generator Mute", RGB(0x87, 0x8B, 0x9F) },2836 { "MV Generator Pan BG", RGB(0x5F, 0x67, 0x92) },2837 { "MV Machine Text", RGB(0x00, 0x00, 0x00) },2838 { "MV Master", RGB(0xC6, 0xBE, 0xAA) },2839 { "MV Master LED Off", RGB(0x59, 0x59, 0x22) },2840 { "MV Master LED On", RGB(0xE8, 0xE8, 0xC1) },2841 { "MV Pan Handle", RGB(0x00, 0x00, 0x00) },2842 { "MV Line", RGB(0x00, 0x00, 0x00) },2843 { "MV Machine Border", RGB(0x00, 0x00, 0x00) },2844 { "PE BG", RGB(0xDA, 0xD6, 0xC9) },2845 { "PE BG Dark", RGB(0xBD, 0xB5, 0x9F) },2846 { "PE BG Very Dark", RGB(0x9F, 0x93, 0x73) },2847 { "PE Sel BG", RGB(0xF7, 0xF7, 0xF4) },2848 { "PE Text", RGB(0x30, 0x30, 0x21) },2849 { "PE Text Note", RGB(0x20, 0x20, 0x80) },2850 { "PE Text Shade", RGB(0x68, 0x68, 0x68) },2851 { "PE Text Margin", RGB(0x7F, 0x73, 0x53) },2852 { "PE Text Note Off", RGB(0xdd, 0x33, 0xdd) },2853 { "SA Amp BG", RGB(0x70, 0x80, 0x90) },2854 { "SA Amp Line", RGB(0x00, 0xC8, 0x00) },2855 { "SA Freq BG", RGB(0x00, 0x00, 0x00) },2856 { "SA Freq Line", RGB(0x00, 0xC8, 0x00) },2857 { "SE BG", RGB(0xDA, 0xD6, 0xC9) },2858 { "SE BG Dark", RGB(0xBD, 0xB5, 0x9F) },2859 { "SE BG Very Dark", RGB(0x9F, 0x93, 0x73) },2860 { "SE Line", RGB(0x00, 0x00, 0x00) },2861 { "SE Sel BG", RGB(0xF7, 0xF7, 0xF4) },2862 { "SE Text", RGB(0x30, 0x30, 0x21) },2863 };2864 2865 const size_t defaultThemeCount = sizeof(defaultTheme) / sizeof(default_theme_type);2866 2811 2867 2812 void CMainFrame::initializeThemes() { … … 2878 2823 2879 2824 themeMenu.CreatePopupMenu(); 2880 themes.clear(); 2881 themes.push_back("<default>"); 2882 themeMenu.InsertMenu(-1, MF_BYPOSITION|MF_STRING, ID_SET_THEME_FIRST, "<default>"); 2883 2884 WIN32_FIND_DATA fd; 2885 string searchPath = "Themes/*.col"; 2886 HANDLE hFind=FindFirstFile(searchPath.c_str(), &fd); 2887 while (hFind!=INVALID_HANDLE_VALUE) { 2888 if ( (fd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)==0) { 2889 string name = fd.cFileName; 2890 size_t ld = name.find_last_of('.'); 2891 if (ld == string::npos) continue; 2892 //string ext = name.substr(ld+1); 2893 name = name.substr(0, ld); 2894 themeMenu.InsertMenu(-1, MF_BYPOSITION|MF_STRING, ID_SET_THEME_FIRST + themes.size(), name.c_str()); 2895 themes.push_back(name); 2896 } 2897 if (!FindNextFile(hFind, &fd)) break; 2898 } 2899 FindClose(hFind); 2900 2825 2826 for (size_t i = 0; i < _Module.themes->getThemes(); i++) { 2827 string name = _Module.themes->getThemeName(i); 2828 themeMenu.InsertMenu(-1, MF_BYPOSITION|MF_STRING, ID_SET_THEME_FIRST + i, name.c_str()); 2829 } 2901 2830 2902 2831 for (int i = 0; i < viewMenu.GetMenuItemCount(); i++) { … … 2912 2841 string themeName = _Module.configuration->getTheme(); 2913 2842 setTheme(themeName); 2914 2915 }2916 2917 size_t CMainFrame::getThemes() {2918 return themes.size();2919 }2920 2921 std::string CMainFrame::getThemeName(size_t index) {2922 return themes[index];2923 }2924 2925 void CMainFrame::setDefaultOverrideColor(std::string dest, std::string src) {2926 map<string, COLORREF>::iterator i;2927 2928 if (theme.find(dest) != theme.end())2929 return;2930 2931 i = theme.find(src);2932 2933 if (i != theme.end())2934 theme.insert(pair<string, COLORREF>(dest, i->second));2935 2843 } 2936 2844 2937 2845 void CMainFrame::setTheme(std::string themeName) { 2938 2939 theme.clear(); 2940 2941 2942 FileReader reader; 2943 string fileName = "Themes/" + themeName + ".col"; 2944 if (reader.open(fileName.c_str())) { 2945 2946 while (!reader.eof()) { 2947 std::string line=trim(reader.readLine()); 2948 if (line.length()==0) continue; 2949 if (line.at(0)=='#') continue; 2950 2951 size_t lt = line.find_first_of('\t'); 2952 if (lt == string::npos) continue; 2953 2954 string name = trim(line.substr(0, lt)); 2955 string colorstr = trim(line.substr(lt+1)); 2956 if (colorstr.length() != 6) continue; 2957 2958 COLORREF color = RGB( 2959 intFromHex(colorstr.substr(0, 2)), 2960 intFromHex(colorstr.substr(2, 2)), 2961 intFromHex(colorstr.substr(4, 2)) 2962 ); 2963 theme[name] = color; 2964 } 2965 reader.close(); 2966 } 2967 2968 #if 0 // Uncomment this so that legacy buzz themes look their best with buze's new theme values 2969 2970 // Theme-based defaults 2971 2972 setDefaultOverrideColor("PE Text Note", "PE Text"); 2973 setDefaultOverrideColor("PE Text Note Off", "PE Text"); 2974 setDefaultOverrideColor("PE Text Shade", "PE Text"); 2975 setDefaultOverrideColor("PE Text Margin", "PE Text Note"); 2976 2977 #endif 2978 2979 // Defaults 2980 2981 for (unsigned int i = 0; i< defaultThemeCount; i++) { 2982 if (theme.find(defaultTheme[i].name) == theme.end()) 2983 theme.insert(pair<string, COLORREF>(defaultTheme[i].name, defaultTheme[i].color)); 2984 } 2985 2986 document->updateAllViews(0, UpdateTheme); 2846 _Module.themes->loadTheme(themeName); 2847 document->updateAllViews(0, UpdateTheme, 0); 2987 2848 2988 2849 char menuName[1024]; … … 2997 2858 2998 2859 _Module.configuration->setTheme(themeName); 2999 }3000 3001 COLORREF CMainFrame::getThemeColor(std::string name) {3002 map<string, COLORREF>::iterator i = theme.find(name);3003 if ( i == theme.end()) return 0;3004 return i->second;3005 2860 } 3006 2861 -
trunk/src/buzelib/MainFrm.h
r1318 r1323 187 187 CMenu createMachineMenu; 188 188 PlurManager plur; 189 std::vector<std::string> themes;190 std::map<std::string, COLORREF> theme;191 189 std::vector<std::string> recents; 192 190 … … 559 557 // themes 560 558 void initializeThemes(); 561 size_t getThemes();562 std::string getThemeName(size_t index);563 559 void setTheme(std::string theme); 564 void setDefaultOverrideColor(std::string dest, std::string src);565 COLORREF getThemeColor(std::string name);566 560 567 561 // Recent Songs -
trunk/src/buzelib/PatternView.cpp
r1319 r1323 11 11 #include "Properties.h" 12 12 #include "Utils/utils.h" 13 #include "Utils/ThemeManager.h" 13 14 #include "EditorActions.h" 14 15 #include "../libzzub/archive.h" … … 1863 1864 1864 1865 void CPatternView::bindTheme() { 1865 patternEditor.SetThemeColor(PE_BG, mainFrame->getThemeColor("PE BG"));1866 patternEditor.SetThemeColor(PE_BG_Dark, mainFrame->getThemeColor("PE BG Dark"));1867 patternEditor.SetThemeColor(PE_BG_VeryDark, mainFrame->getThemeColor("PE BG Very Dark"));1868 patternEditor.SetThemeColor(PE_Sel_BG, mainFrame->getThemeColor("PE Sel BG"));1869 patternEditor.SetThemeColor(PE_TextValue, mainFrame->getThemeColor("PE Text"));1870 patternEditor.SetThemeColor(PE_TextMargin, mainFrame->getThemeColor("PE Text Margin"));1871 patternEditor.SetThemeColor(PE_TextNote, mainFrame->getThemeColor("PE Text Note"));1872 patternEditor.SetThemeColor(PE_TextNoteOff, mainFrame->getThemeColor("PE Text Note Off"));1873 patternEditor.SetThemeColor(PE_TextShade, mainFrame->getThemeColor("PE Text Shade"));1874 patternEditor.SetThemeColor(PE_BG_Dark, mainFrame->getThemeColor("PE BG Dark"));1866 patternEditor.SetThemeColor(PE_BG, _Module.themes->getThemeColor("PE BG")); 1867 patternEditor.SetThemeColor(PE_BG_Dark, _Module.themes->getThemeColor("PE BG Dark")); 1868 patternEditor.SetThemeColor(PE_BG_VeryDark, _Module.themes->getThemeColor("PE BG Very Dark")); 1869 patternEditor.SetThemeColor(PE_Sel_BG, _Module.themes->getThemeColor("PE Sel BG")); 1870 patternEditor.SetThemeColor(PE_TextValue, _Module.themes->getThemeColor("PE Text")); 1871 patternEditor.SetThemeColor(PE_TextMargin, _Module.themes->getThemeColor("PE Text Margin")); 1872 patternEditor.SetThemeColor(PE_TextNote, _Module.themes->getThemeColor("PE Text Note")); 1873 patternEditor.SetThemeColor(PE_TextNoteOff, _Module.themes->getThemeColor("PE Text Note Off")); 1874 patternEditor.SetThemeColor(PE_TextShade, _Module.themes->getThemeColor("PE Text Shade")); 1875 patternEditor.SetThemeColor(PE_BG_Dark, _Module.themes->getThemeColor("PE BG Dark")); 1875 1876 patternEditor.Invalidate(); 1876 1877 patternEditor.editor.Invalidate(FALSE); -
trunk/src/buzelib/SequenceEditor.cpp
r1320 r1323 8 8 #include "SequenceView.h" 9 9 #include "Properties.h" 10 #include "Utils/ThemeManager.h" 10 11 #include "../libzzub/archive.h" 11 12 #include "../libzzub/recorder.h" … … 348 349 349 350 CPenHandle prevPen = (HPEN)SelectObject(dc, bgPen.m_hPen); 350 dc.SetTextColor( mainFrame->getThemeColor("SE Text"));351 dc.SetBkColor( mainFrame->getThemeColor("SE BG"));351 dc.SetTextColor(_Module.themes->getThemeColor("SE Text")); 352 dc.SetBkColor(_Module.themes->getThemeColor("SE BG")); 352 353 // dc.SetBkColor(RGB(0xDA, 0xD6, 0xC9)); 353 354 … … 411 412 412 413 //dc.SetTextColor(0); 413 dc.SetBkColor( mainFrame->getThemeColor("SE BG"));414 dc.SetBkColor(_Module.themes->getThemeColor("SE BG")); 414 415 415 416 // determine highlight color 416 417 if(stepIncrement && miniStepIncrement) { 417 418 if (!(row % stepIncrement)) { 418 dc.SetBkColor( mainFrame->getThemeColor("SE BG Very Dark"));419 dc.SetBkColor(_Module.themes->getThemeColor("SE BG Very Dark")); 419 420 lastStep = row; 420 421 } 421 422 else if (row - lastStep == miniStepIncrement) { 422 dc.SetBkColor( mainFrame->getThemeColor("SE BG Dark"));423 dc.SetBkColor(_Module.themes->getThemeColor("SE BG Dark")); 423 424 lastStep = row; 424 425 } … … 995 996 if (selBrush) selBrush.DeleteObject(); 996 997 997 blackBrush.CreateSolidBrush(mainFrame->getThemeColor("SE Line")); 998 bgPen.CreatePen(PS_NULL, 0, mainFrame->getThemeColor("SE Line")); 999 bgBrush.CreateSolidBrush(mainFrame->getThemeColor("SE BG")); 1000 bgShadeBrush.CreateSolidBrush(mainFrame->getThemeColor("SE BG Dark")); 1001 // bgShadeBrush.CreateSolidBrush(RGB((float)0xDA * 0.95, (float)0xD6* 0.95, (float)0xC9* 0.95)); 1002 // selBrush.CreateSolidBrush(RGB(0xFF, 0xFF, 0xFF)); 1003 selBrush.CreateSolidBrush(mainFrame->getThemeColor("SE Sel BG")); 998 blackBrush.CreateSolidBrush(_Module.themes->getThemeColor("SE Line")); 999 bgPen.CreatePen(PS_NULL, 0, _Module.themes->getThemeColor("SE Line")); 1000 bgBrush.CreateSolidBrush(_Module.themes->getThemeColor("SE BG")); 1001 bgShadeBrush.CreateSolidBrush(_Module.themes->getThemeColor("SE BG Dark")); 1002 selBrush.CreateSolidBrush(_Module.themes->getThemeColor("SE Sel BG")); 1004 1003 1005 1004 invalidateSequencer(); -
trunk/src/buzelib/buze.cpp
r1283 r1323 9 9 #include "buze.h" 10 10 #include "Utils/utils.h" 11 #include "Utils/ThemeManager.h" 11 12 #include "../libzzub/tools.h" 12 13 #ifndef _USE_OLD_IOSTREAMS … … 91 92 // hide but do not show wait window 92 93 waitWindow.Create(GetDesktopWindow()); 94 95 themes = new ThemeManager(); 96 themes->initialize(); 93 97 } 94 98 -
trunk/src/buzelib/buze.h
r1236 r1323 3 3 class CMainFrame; 4 4 class CConfiguration; 5 class ThemeManager; 5 6 6 7 struct MachineSkin { … … 36 37 CConfiguration* configuration; 37 38 CWaitWindow waitWindow; 39 ThemeManager* themes; 38 40 39 41 CBuzeModule();
