| 1 | #include "DST_WinManager.h" |
|---|
| 2 | #include "DST_OSDImage.h" |
|---|
| 3 | #include "DST_UserInterface.h" |
|---|
| 4 | #include "DST_DataStrings.h" |
|---|
| 5 | |
|---|
| 6 | #if 0 |
|---|
| 7 | ____CVolumeWin___() |
|---|
| 8 | #endif |
|---|
| 9 | |
|---|
| 10 | extern DS_U8 volume_banner_back_mute_800[]; |
|---|
| 11 | |
|---|
| 12 | class CVolumeWin : public CWindow |
|---|
| 13 | { |
|---|
| 14 | public: |
|---|
| 15 | CVolumeWin(SWinEventMsg event):CWindow(event) |
|---|
| 16 | { |
|---|
| 17 | rect.w = DST_GetImageWidth(newcon2_gui_volume_back); |
|---|
| 18 | rect.h = DST_GetImageHeight(newcon2_gui_volume_back); |
|---|
| 19 | rect.x = (DST_GetScreenWidth() - rect.w) / 2; |
|---|
| 20 | rect.y = DST_GetScreenHeight()*9/10 - rect.h; |
|---|
| 21 | SetTimeOut(3); |
|---|
| 22 | } |
|---|
| 23 | virtual void OnMessage(SWinEventMsg event) |
|---|
| 24 | { |
|---|
| 25 | switch (event.cmd) |
|---|
| 26 | { |
|---|
| 27 | case WM_POWER_OFF: |
|---|
| 28 | Close(); |
|---|
| 29 | break; |
|---|
| 30 | } |
|---|
| 31 | } |
|---|
| 32 | virtual void Show(WinID id) |
|---|
| 33 | { |
|---|
| 34 | switch(id) |
|---|
| 35 | { |
|---|
| 36 | case WIN_EWS: |
|---|
| 37 | case WIN_CHANNEL_BANNER: |
|---|
| 38 | case WIN_DIRECT_TUNE: |
|---|
| 39 | //case WIN_VOLUME: |
|---|
| 40 | case WIN_VOLUME_MUTE: |
|---|
| 41 | case WIN_SIGNAL_METER: |
|---|
| 42 | case WIN_CLOSED_CAPTION_HOT: |
|---|
| 43 | case WIN_AUDIO_HOT: |
|---|
| 44 | case WIN_DISPLAY_MODE_HOT: |
|---|
| 45 | case WIN_FACTORY_RESET: |
|---|
| 46 | case WIN_FACTORY_RESET_ASK: |
|---|
| 47 | case WIN_INFOR_BANNER: |
|---|
| 48 | case WIN_MAIN_MENU: |
|---|
| 49 | case WIN_POWER_DOWN_CAUTION: |
|---|
| 50 | case WIN_SUB_MENU_2DEPTH: |
|---|
| 51 | case WIN_SUB_MENU_3DEPTH: |
|---|
| 52 | case WIN_SUB_MENU_4DEPTH: |
|---|
| 53 | case WIN_AUTO_SEARCH: |
|---|
| 54 | case WIN_MANUAL_SEARCH: |
|---|
| 55 | case WIN_CHANNEL_LIST: |
|---|
| 56 | case WIN_PROGRAM_GUIDE: |
|---|
| 57 | Close(); |
|---|
| 58 | break; |
|---|
| 59 | default: |
|---|
| 60 | break; |
|---|
| 61 | } |
|---|
| 62 | } |
|---|
| 63 | virtual void Show() |
|---|
| 64 | { |
|---|
| 65 | RegisterKey(VK_CANCEL,true); |
|---|
| 66 | DrawImage(0, 0, DST_UI_GetMute() ? newcon2_gui_volume_back : newcon2_gui_volume_back); |
|---|
| 67 | setFontStyle(20, 0xFFC8C8C8, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 68 | |
|---|
| 69 | DS_U16 final[20]; |
|---|
| 70 | memset(final,0,sizeof(final)); |
|---|
| 71 | strcpy16(final, pz_Volume[OSD_Lang]); |
|---|
| 72 | char tmpStr[10]; |
|---|
| 73 | memset(tmpStr,0,sizeof(tmpStr)); |
|---|
| 74 | sprintf(tmpStr," %d", DST_UI_GetVolume()); |
|---|
| 75 | str2uni(&final[strlen16(final)], (char *)tmpStr); |
|---|
| 76 | DrawTextUni(7 , 19, 132, 29, final, &font); |
|---|
| 77 | |
|---|
| 78 | DrawProgressBar(138, 28, 291, 50, DST_UI_GetVolume()); |
|---|
| 79 | } |
|---|
| 80 | void DrawProgressBar(int x, int y, int w, int range, int pos) |
|---|
| 81 | { |
|---|
| 82 | int position = (w*pos)/(range); |
|---|
| 83 | |
|---|
| 84 | if (DST_UI_GetVolume() > 0) |
|---|
| 85 | { |
|---|
| 86 | for (int i = x; i < x+position; i++) |
|---|
| 87 | { |
|---|
| 88 | DrawImage(i, y, newcon2_gui_progress_gray); |
|---|
| 89 | } |
|---|
| 90 | } |
|---|
| 91 | } |
|---|
| 92 | virtual void KeyInput(DS_U8 key, bool /*bRepeat*/) |
|---|
| 93 | { |
|---|
| 94 | switch (key) |
|---|
| 95 | { |
|---|
| 96 | case VK_CANCEL: |
|---|
| 97 | Close(); |
|---|
| 98 | break; |
|---|
| 99 | } |
|---|
| 100 | } |
|---|
| 101 | |
|---|
| 102 | }; |
|---|
| 103 | void DST_CreateVolumeWindow(SWinEventMsg event) |
|---|
| 104 | { |
|---|
| 105 | DST_AddWin((WinID)(event.data[0]), new CVolumeWin(event)); |
|---|
| 106 | } |
|---|
| 107 | |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | class CVolumeMuteWin : public CWindow |
|---|
| 111 | { |
|---|
| 112 | private: |
|---|
| 113 | public: |
|---|
| 114 | CVolumeMuteWin(SWinEventMsg event):CWindow(event) |
|---|
| 115 | { |
|---|
| 116 | rect.w = DST_GetImageWidth(newcon2_gui_banner_mute_back); |
|---|
| 117 | rect.h = DST_GetImageHeight(newcon2_gui_banner_mute_back); |
|---|
| 118 | rect.x = (DST_GetScreenWidth() - rect.w) / 2; |
|---|
| 119 | rect.y = DST_GetScreenHeight()*9/10 - rect.h; |
|---|
| 120 | |
|---|
| 121 | SetTimeOut(3); |
|---|
| 122 | } |
|---|
| 123 | |
|---|
| 124 | virtual void Show(WinID id) |
|---|
| 125 | { |
|---|
| 126 | switch(id) |
|---|
| 127 | { |
|---|
| 128 | case WIN_EWS: |
|---|
| 129 | case WIN_CHANNEL_BANNER: |
|---|
| 130 | case WIN_DIRECT_TUNE: |
|---|
| 131 | case WIN_VOLUME: |
|---|
| 132 | case WIN_SIGNAL_METER: |
|---|
| 133 | case WIN_CLOSED_CAPTION_HOT: |
|---|
| 134 | case WIN_AUDIO_HOT: |
|---|
| 135 | case WIN_DISPLAY_MODE_HOT: |
|---|
| 136 | case WIN_FACTORY_RESET: |
|---|
| 137 | case WIN_FACTORY_RESET_ASK: |
|---|
| 138 | case WIN_INFOR_BANNER: |
|---|
| 139 | case WIN_MAIN_MENU: |
|---|
| 140 | case WIN_POWER_DOWN_CAUTION: |
|---|
| 141 | case WIN_SUB_MENU_2DEPTH: |
|---|
| 142 | case WIN_SUB_MENU_3DEPTH: |
|---|
| 143 | case WIN_SUB_MENU_4DEPTH: |
|---|
| 144 | case WIN_AUTO_SEARCH: |
|---|
| 145 | case WIN_MANUAL_SEARCH: |
|---|
| 146 | case WIN_CHANNEL_LIST: |
|---|
| 147 | case WIN_PROGRAM_GUIDE: |
|---|
| 148 | Close(); |
|---|
| 149 | break; |
|---|
| 150 | default: |
|---|
| 151 | break; |
|---|
| 152 | } |
|---|
| 153 | } |
|---|
| 154 | |
|---|
| 155 | |
|---|
| 156 | virtual void Show() |
|---|
| 157 | { |
|---|
| 158 | RegisterKey(VK_CANCEL,true); |
|---|
| 159 | DrawImage(0, 0, newcon2_gui_banner_mute_back); |
|---|
| 160 | setFontStyle(25, 0xFFC8C8C8, ALIGN_MIDDLE,ALIGN_CENTER); |
|---|
| 161 | char muteStr[10]; |
|---|
| 162 | if(DST_UI_GetMute()) sprintf(muteStr, "Mute On" ); |
|---|
| 163 | else sprintf(muteStr, "Mute Off" ); |
|---|
| 164 | DrawText(0, 0, rect.w, rect.h, muteStr, &font); |
|---|
| 165 | |
|---|
| 166 | } |
|---|
| 167 | virtual void KeyInput(DS_U8 key, bool /*bRepeat*/) |
|---|
| 168 | { |
|---|
| 169 | switch (key) |
|---|
| 170 | { |
|---|
| 171 | case VK_CANCEL: |
|---|
| 172 | Close(); |
|---|
| 173 | break; |
|---|
| 174 | } |
|---|
| 175 | } |
|---|
| 176 | |
|---|
| 177 | |
|---|
| 178 | }; |
|---|
| 179 | |
|---|
| 180 | |
|---|
| 181 | void DST_CreateVolumeMuteWindow(SWinEventMsg event) |
|---|
| 182 | { |
|---|
| 183 | DST_AddWin((WinID)(event.data[0]), new CVolumeMuteWin(event)); |
|---|
| 184 | } |
|---|
| 185 | |
|---|