~medibuntu-maintainers/mplayer/medibuntu.precise

« back to all changes in this revision

Viewing changes to gui/win32/gui.c

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-01-12 22:23:28 UTC
  • mfrom: (0.4.7 sid)
  • mto: This revision was merged to the branch mainline in revision 76.
  • Revision ID: package-import@ubuntu.com-20120112222328-8jqdyodym3p84ygu
Tags: 2:1.0~rc4.dfsg1+svn34540-1
* New upstream snapshot
* upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
#include "libvo/video_out.h"
42
42
#include "libmpcodecs/vd.h"
43
43
#include "gui/interface.h"
 
44
#include "gui/ui/actions.h"
44
45
#include "gui/ui/gmplayer.h"
 
46
#include "gui/util/mem.h"
45
47
#include "gui.h"
46
48
#include "dialogs.h"
 
49
#include "version.h"
47
50
 
48
51
// HACK around bug in old mingw
49
52
#undef INVALID_FILE_ATTRIBUTES
66
69
static HBRUSH    colorbrush = NULL;           //Handle to colorkey brush
67
70
static COLORREF windowcolor = RGB(255,0,255); //Windowcolor == colorkey
68
71
 
 
72
/**
 
73
 * @brief Convert an UTF-8 encoded string into ANSI codepage encoding.
 
74
 *
 
75
 * @param utf8 UTF-8 encoded string
 
76
 *
 
77
 * @return string containing ANSI codepage encoding of @a utf8 (or, in case
 
78
 *         of error, a string containing the question mark character)
 
79
 */
 
80
LPSTR acp (LPCSTR utf8)
 
81
{
 
82
    static LPSTR acp_str = NULL;
 
83
    int chars;
 
84
    LPWSTR uc_str;
 
85
 
 
86
    chars = MultiByteToWideChar(CP_UTF8, 0, utf8, -1, NULL, 0);
 
87
 
 
88
    if (chars)
 
89
    {
 
90
        uc_str = malloc(sizeof(*uc_str) * (chars + 1));
 
91
 
 
92
        if (uc_str)
 
93
        {
 
94
            MultiByteToWideChar(CP_UTF8, 0, utf8, -1, uc_str, chars);
 
95
 
 
96
            chars = WideCharToMultiByte(CP_ACP, 0, uc_str, -1, NULL, 0, NULL, 0);
 
97
 
 
98
            if (chars)
 
99
            {
 
100
                free(acp_str);
 
101
                acp_str = malloc(sizeof(*acp_str) * (chars + 1));
 
102
 
 
103
                if (acp_str)
 
104
                {
 
105
                    WideCharToMultiByte(CP_ACP, 0, uc_str, -1, acp_str, chars, NULL, 0);
 
106
                    free(uc_str);
 
107
 
 
108
                    return acp_str;
 
109
                }
 
110
            }
 
111
 
 
112
            free(uc_str);
 
113
        }
 
114
    }
 
115
 
 
116
    return "?";
 
117
}
 
118
 
69
119
static void console_toggle(void)
70
120
{
71
121
    if (console_state)
126
176
            filename[i] = tolower(filename[i]);
127
177
    }
128
178
}
 
179
static void display_about_box(HWND hWnd)
 
180
{
 
181
    char about_msg[512];
 
182
    snprintf(about_msg, sizeof(about_msg), MP_TITLE "\n" COPYRIGHT, "MPlayer");
 
183
    MessageBox(hWnd, about_msg, acp(MSGTR_About), MB_OK);
 
184
}
129
185
 
130
186
static image *get_drawground(HWND hwnd)
131
187
{
182
238
        case evLoadPlay:
183
239
        case evLoad:
184
240
            if(display_openfilewindow(gui, 0) && (msg == evLoadPlay))
185
 
                handlemsg(hWnd, evDropFile);
 
241
                gui->playercontrol(evLoadPlay);
186
242
            return;
187
243
        case evLoadSubtitle:
188
244
            display_opensubtitlewindow(gui);
190
246
        case evPreferences:
191
247
            display_prefswindow(gui);
192
248
            return;
193
 
        case evPlayList:
 
249
        case evPlaylist:
194
250
            display_playlistwindow(gui);
195
251
            return;
196
252
        case evSkinBrowser:
200
256
            display_eqwindow(gui);
201
257
            break;
202
258
        case evAbout:
203
 
            MessageBox(hWnd, COPYRIGHT, "About", MB_OK);
 
259
            display_about_box(hWnd);
204
260
            break;
205
261
        case evIconify:
206
262
            ShowWindow(hWnd, SW_MINIMIZE);
278
334
    if((time - oldtime) < 100) return;
279
335
    oldtime=time;
280
336
 
281
 
    /* suppress directx's fullscreen window when using the sub window */
282
 
    if(sub_window && &video_driver_list[0] && strstr("directx", video_driver_list[0]))
283
 
    {
284
 
        HWND hWndFS = NULL; //handle to directx's fullscreen window
285
 
        if(hWndFS == NULL)
286
 
        {
287
 
            hWndFS = FindWindow(NULL, "MPlayer Fullscreen");
288
 
            if(hWndFS != NULL) DestroyWindow(hWndFS); //sub window handles fullscreen
289
 
        }
290
 
    }
291
 
 
292
337
    for (i=0; i<gui->window_priv_count; i++)
293
338
    {
294
339
        if(gui->window_priv[i]->hwnd == hwnd)
378
423
                    BROWSEINFO bi;
379
424
                    LPITEMIDLIST pidl;
380
425
                    memset(&bi, 0, sizeof(BROWSEINFO));
381
 
                    bi.lpszTitle = "Choose a Directory...";
 
426
                    bi.lpszTitle = acp(MSGTR_DirectorySelect);
382
427
                    pidl = SHBrowseForFolder(&bi);
383
428
                    if (SHGetPathFromIDList(pidl, path))
384
429
                    {
456
501
                        gui->playlist->add_track(gui->playlist, file, NULL, NULL, 0);
457
502
                }
458
503
                DragFinish((HDROP) wParam);
459
 
                handlemsg(hWnd, evDropFile);
 
504
                gui->playercontrol(evLoadPlay);
460
505
            }
461
506
            else
462
507
            {
463
508
                gui->playlist->clear_playlist(gui->playlist);
464
509
                gui->playlist->add_track(gui->playlist, (const char *) wParam, NULL, NULL, 0);
465
 
                handlemsg(hWnd, evDropFile);
 
510
                gui->playercontrol(evLoadPlay);
466
511
            }
467
512
            SetForegroundWindow(gui->subwindow);
468
513
            return 0;
745
790
                        gui->playlist->add_track(gui->playlist, file, NULL, NULL, 0);
746
791
                }
747
792
                DragFinish((HDROP) wParam);
748
 
                handlemsg(hWnd, evDropFile);
 
793
                gui->playercontrol(evLoadPlay);
749
794
            }
750
795
            else
751
796
            {
752
797
                gui->playlist->clear_playlist(gui->playlist);
753
798
                gui->playlist->add_track(gui->playlist, (const char *) wParam, NULL, NULL, 0);
754
 
                handlemsg(hWnd, evDropFile);
 
799
                gui->playercontrol(evLoadPlay);
755
800
            }
756
801
            SetForegroundWindow(gui->mainwindow);
757
802
            return 0;
802
847
            POINT point;
803
848
            char device[MAX_PATH];
804
849
            char searchpath[MAX_PATH];
805
 
            char searchpath2[MAX_PATH];
806
 
#ifdef CONFIG_LIBCDIO
807
 
            char searchpath3[MAX_PATH];
808
 
#endif
809
850
            int len, pos = 0, cdromdrive = 0;
810
851
            UINT errmode;
811
852
            point.x = GET_X_LPARAM(lParam);
821
862
                {
822
863
                    char volname[MAX_PATH];
823
864
                    char menuitem[MAX_PATH];
824
 
                    int flags = MF_STRING;
 
865
                    int flags = MF_STRING, enable = 0;
825
866
                    mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] checking %s for CD/VCD/SVCD/DVDs\n", device + pos);
826
867
                    sprintf(searchpath, "%sVIDEO_TS", device + pos);
827
 
                    sprintf(searchpath2, "%sMpegav", device + pos);
828
 
#ifdef CONFIG_LIBCDIO
829
 
                    sprintf(searchpath3, "%sTrack01.cda", device + pos);
830
 
#endif
831
 
                    if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
832
 
                        flags |= MF_ENABLED;
833
 
                    else if(GetFileAttributes(searchpath2) != INVALID_FILE_ATTRIBUTES)
834
 
                        flags |= MF_ENABLED;
835
 
#ifdef CONFIG_LIBCDIO
836
 
                    else if(GetFileAttributes(searchpath3) != INVALID_FILE_ATTRIBUTES)
837
 
                        flags |= MF_ENABLED;
838
 
#endif
839
 
                    else
840
 
                        flags |= MF_GRAYED;
 
868
                    if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
 
869
                        enable = 1;
 
870
                    sprintf(searchpath, "%sMpegav", device + pos);
 
871
                    if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
 
872
                        enable = 1;
 
873
#ifdef CONFIG_CDDA
 
874
                    sprintf(searchpath, "%sTrack01.cda", device + pos);
 
875
                    if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
 
876
                        enable = 1;
 
877
#endif
 
878
                    flags |= (enable ? MF_ENABLED : MF_GRAYED);
841
879
                    volname[0] = 0;
842
880
                    strcpy(menuitem, device + pos);
843
881
                    menuitem[strlen(menuitem) - 1]=0;
929
967
                    BROWSEINFO bi;
930
968
                    LPITEMIDLIST pidl;
931
969
                    memset(&bi, 0, sizeof(BROWSEINFO));
932
 
                    bi.lpszTitle = "Choose a Directory...";
 
970
                    bi.lpszTitle = acp(MSGTR_DirectorySelect);
933
971
                    pidl = SHBrowseForFolder(&bi);
934
972
                    if (SHGetPathFromIDList(pidl, path))
935
973
                    {
976
1014
                    break;
977
1015
                }
978
1016
                case ID_PLAYLIST:
979
 
                    handlemsg(hWnd, evPlayList);
 
1017
                    handlemsg(hWnd, evPlaylist);
980
1018
                    break;
981
1019
                case ID_PREFS:
982
1020
                    handlemsg(hWnd, evPreferences);
987
1025
                case ID_ONLINEHELP:
988
1026
                    ShellExecute(NULL, "open", ONLINE_HELP_URL, NULL, NULL, SW_SHOWNORMAL);
989
1027
                    break;
 
1028
                case IDHELP_ABOUT:
 
1029
                    handlemsg(hWnd, evAbout);
 
1030
                    break;
990
1031
            }
991
1032
            if((IDPLAYDISK <= LOWORD(wParam)) && (LOWORD(wParam) < (IDPLAYDISK + 100)))
992
1033
            {
1007
1048
#ifdef CONFIG_DVDREAD
1008
1049
                                free(dvd_device);
1009
1050
                                dvd_device = strdup(device + pos);
1010
 
                                dvd_title = dvd_chapter = dvd_angle = 1;
1011
1051
                                handlemsg(hWnd, evPlayDVD);
1012
1052
#endif
1013
1053
                            }
1014
1054
                            sprintf(searchpath, "%sTrack01.cda", device + pos);
1015
1055
                            if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
1016
1056
                            {
1017
 
#ifdef CONFIG_LIBCDIO
 
1057
#ifdef CONFIG_CDDA
1018
1058
                                free(cdrom_device);
1019
1059
                                cdrom_device = strdup(device + pos);
1020
1060
                                /* mplayer doesn't seem to like the trailing \ after the device name */
1024
1064
                            } else {
1025
1065
                                HANDLE searchhndl;
1026
1066
                                WIN32_FIND_DATA finddata;
1027
 
                                sprintf(searchpath, "%smpegav\\*.dat", device + pos);
 
1067
                                sprintf(searchpath, "%smpegav/*.dat", device + pos);
1028
1068
                                if((searchhndl=FindFirstFile(searchpath, &finddata)) != INVALID_HANDLE_VALUE)
1029
1069
                                {
1030
1070
                                    mp_msg(MSGT_GPLAYER,MSGL_V, "Opening VCD/SVCD\n");
1031
1071
                                    gui->playlist->clear_playlist(gui->playlist);
1032
1072
                                    do
1033
1073
                                    {
1034
 
                                        sprintf(filename, "%smpegav\\%s", device + pos, finddata.cFileName);
 
1074
                                        sprintf(filename, "%smpegav/%s", device + pos, finddata.cFileName);
1035
1075
                                        gui->playlist->add_track(gui->playlist, filename, NULL, NULL, 0);
1036
1076
                                    }
1037
1077
                                    while(FindNextFile(searchhndl, &finddata));
1070
1110
 
1071
1111
static void startplay(gui_t *gui)
1072
1112
{
1073
 
    handlemsg(gui->mainwindow, evDropFile);
 
1113
    gui->playercontrol(evLoadPlay);
1074
1114
}
1075
1115
 
1076
1116
/* returns the bits per pixel of the desktop */
1117
1157
            DeleteObject(gui->window_priv[i]->bitmap);
1118
1158
        free(gui->window_priv[i]);
1119
1159
    }
1120
 
    free(gui->window_priv);
1121
 
    gui->window_priv = NULL;
 
1160
    nfree(gui->window_priv);
1122
1161
    gui->window_priv_count = 0;
1123
1162
 
1124
1163
    /* destroy the main window */
1144
1183
    gui->diskmenu = CreatePopupMenu();
1145
1184
    gui->menu=CreatePopupMenu();
1146
1185
    gui->trayplaymenu = CreatePopupMenu();
1147
 
    AppendMenu(gui->menu, MF_STRING | MF_POPUP, (UINT) gui->trayplaymenu, "Open...");
1148
 
    AppendMenu(gui->trayplaymenu, MF_STRING, IDFILE_OPEN, "File...");
1149
 
    AppendMenu(gui->trayplaymenu, MF_STRING, IDURL_OPEN, "Url...");
1150
 
    AppendMenu(gui->trayplaymenu, MF_STRING, IDDIR_OPEN, "Directory...");
1151
 
    AppendMenu(gui->menu, MF_SEPARATOR, 0, 0);
1152
 
    AppendMenu(gui->menu, MF_STRING | MF_POPUP, (UINT) gui->diskmenu, "Play &CD/DVD/VCD/SVCD");
1153
 
    AppendMenu(gui->menu, MF_SEPARATOR, 0, 0);
1154
 
    AppendMenu(gui->menu, MF_STRING, IDSUBTITLE_OPEN, "Open Subtitle");
1155
 
    AppendMenu(gui->menu, MF_STRING, ID_SKINBROWSER, "Skin Browser");
1156
 
    AppendMenu(gui->menu, MF_SEPARATOR, 0, 0);
1157
 
    AppendMenu(gui->menu, MF_STRING, ID_PREFS, "Preferences");
1158
 
    AppendMenu(gui->menu, MF_STRING, ID_CONSOLE, "Debug Console");
1159
 
    AppendMenu(gui->menu, MF_STRING, ID_ONLINEHELP, "Online Help");
1160
 
    AppendMenu(gui->menu, MF_SEPARATOR, 0, 0);
1161
 
    AppendMenu(gui->menu, MF_STRING, IDEXIT, "&Exit");
 
1186
    AppendMenu(gui->menu, MF_STRING | MF_POPUP, (UINT_PTR) gui->trayplaymenu, acp(MSGTR_MENU_Open));
 
1187
    AppendMenu(gui->trayplaymenu, MF_STRING, IDFILE_OPEN, acp(MSGTR_MENU_PlayFile));
 
1188
    AppendMenu(gui->trayplaymenu, MF_STRING, IDURL_OPEN, acp(MSGTR_MENU_PlayURL));
 
1189
    AppendMenu(gui->trayplaymenu, MF_STRING, IDDIR_OPEN, acp(MSGTR_MENU_PlayDirectory));
 
1190
    AppendMenu(gui->menu, MF_SEPARATOR, 0, 0);
 
1191
    AppendMenu(gui->menu, MF_STRING | MF_POPUP, (UINT_PTR) gui->diskmenu, acp(MSGTR_MENU_PlayDisc));
 
1192
    AppendMenu(gui->menu, MF_SEPARATOR, 0, 0);
 
1193
    AppendMenu(gui->menu, MF_STRING, IDSUBTITLE_OPEN, acp(MSGTR_MENU_LoadSubtitle));
 
1194
    AppendMenu(gui->menu, MF_STRING, ID_SKINBROWSER, acp(MSGTR_MENU_SkinBrowser));
 
1195
    AppendMenu(gui->menu, MF_SEPARATOR, 0, 0);
 
1196
    AppendMenu(gui->menu, MF_STRING, ID_PREFS, acp(MSGTR_MENU_Preferences));
 
1197
    AppendMenu(gui->menu, MF_STRING, ID_CONSOLE, acp(MSGTR_MENU_DebugConsole));
 
1198
    AppendMenu(gui->menu, MF_STRING, ID_ONLINEHELP, acp(MSGTR_MENU_OnlineHelp));
 
1199
    AppendMenu(gui->menu, MF_STRING, IDHELP_ABOUT, acp(MSGTR_MENU_AboutMPlayer));
 
1200
    AppendMenu(gui->menu, MF_SEPARATOR, 0, 0);
 
1201
    AppendMenu(gui->menu, MF_STRING, IDEXIT, acp(MSGTR_MENU_Exit));
1162
1202
}
1163
1203
 
1164
1204
static void create_traymenu(gui_t *gui)
1165
1205
{
1166
1206
    gui->traymenu = CreatePopupMenu();
1167
1207
    gui->trayplaybackmenu = CreatePopupMenu();
1168
 
    AppendMenu(gui->traymenu, MF_STRING | MF_POPUP, (UINT) gui->trayplaymenu, "Open...");
1169
 
    AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
1170
 
    AppendMenu(gui->traymenu, MF_STRING | MF_POPUP, (UINT) gui->trayplaybackmenu, "Playback");
1171
 
    AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_SEEKB, "Seek Backwards");
1172
 
    AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_PTRACK, "Previous Track");
1173
 
    AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_PLAY, "Play/Pause");
1174
 
    AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_STOP, "Stop");
1175
 
    AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_NTRACK, "Next Track");
1176
 
    AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_SEEKF, "Seek Forwards");
1177
 
    AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
1178
 
    AppendMenu(gui->traymenu, MF_STRING, ID_MUTE, "Toggle Mute");
1179
 
    AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
1180
 
    AppendMenu(gui->traymenu, MF_STRING, IDSUBTITLE_OPEN, "Open Subtitle");
1181
 
    AppendMenu(gui->traymenu, MF_STRING, ID_PLAYLIST, "Playlist");
1182
 
    AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
1183
 
    AppendMenu(gui->traymenu, MF_STRING, ID_SHOWHIDE, "Show/Hide");
1184
 
    AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
1185
 
    AppendMenu(gui->traymenu, MF_STRING, ID_PREFS, "Preferences");
1186
 
    AppendMenu(gui->traymenu, MF_STRING, ID_CONSOLE, "Debug Console");
1187
 
    AppendMenu(gui->traymenu, MF_STRING, ID_ONLINEHELP, "Online Help");
1188
 
    AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
1189
 
    AppendMenu(gui->traymenu, MF_STRING, IDEXIT, "&Exit");
 
1208
    AppendMenu(gui->traymenu, MF_STRING | MF_POPUP, (UINT_PTR) gui->trayplaymenu, acp(MSGTR_MENU_Open));
 
1209
    AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
 
1210
    AppendMenu(gui->traymenu, MF_STRING | MF_POPUP, (UINT_PTR) gui->trayplaybackmenu, acp(MSGTR_MENU_Playing));
 
1211
    AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_SEEKB, acp(MSGTR_MENU_SeekBack));
 
1212
    AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_PTRACK, acp(MSGTR_MENU_PrevStream));
 
1213
    AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_PLAY, acp(MSGTR_MENU_Play "/" MSGTR_MENU_Pause));
 
1214
    AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_STOP, acp(MSGTR_MENU_Stop));
 
1215
    AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_NTRACK, acp(MSGTR_MENU_NextStream));
 
1216
    AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_SEEKF, acp(MSGTR_MENU_SeekForw));
 
1217
    AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
 
1218
    AppendMenu(gui->traymenu, MF_STRING, ID_MUTE, acp(MSGTR_MENU_Mute));
 
1219
    AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
 
1220
    AppendMenu(gui->traymenu, MF_STRING, IDSUBTITLE_OPEN, acp(MSGTR_MENU_LoadSubtitle));
 
1221
    AppendMenu(gui->traymenu, MF_STRING, ID_PLAYLIST, acp(MSGTR_MENU_PlayList));
 
1222
    AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
 
1223
    AppendMenu(gui->traymenu, MF_STRING, ID_SHOWHIDE, acp(MSGTR_MENU_ShowHide));
 
1224
    AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
 
1225
    AppendMenu(gui->traymenu, MF_STRING, ID_PREFS, acp(MSGTR_MENU_Preferences));
 
1226
    AppendMenu(gui->traymenu, MF_STRING, ID_CONSOLE, acp(MSGTR_MENU_DebugConsole));
 
1227
    AppendMenu(gui->traymenu, MF_STRING, ID_ONLINEHELP, acp(MSGTR_MENU_OnlineHelp));
 
1228
    AppendMenu(gui->traymenu, MF_STRING, IDHELP_ABOUT, acp(MSGTR_MENU_AboutMPlayer));
 
1229
    AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
 
1230
    AppendMenu(gui->traymenu, MF_STRING, IDEXIT, acp(MSGTR_MENU_Exit));
1190
1231
}
1191
1232
 
1192
1233
static void create_submenu(gui_t *gui)
1195
1236
    gui->dvdmenu = CreatePopupMenu();
1196
1237
    gui->aspectmenu = CreatePopupMenu();
1197
1238
    gui->subtitlemenu = CreatePopupMenu();
1198
 
    AppendMenu(gui->submenu, MF_STRING | MF_POPUP, (UINT) gui->trayplaymenu, "Open...");
1199
 
    AppendMenu(gui->submenu, MF_SEPARATOR, 0, 0);
1200
 
    AppendMenu(gui->submenu, MF_STRING, ID_SEEKB, "Seek Backwards");
1201
 
    AppendMenu(gui->submenu, MF_STRING, ID_PTRACK, "Previous Track");
1202
 
    AppendMenu(gui->submenu, MF_STRING, ID_PLAY, "Play/Pause");
1203
 
    AppendMenu(gui->submenu, MF_STRING, ID_STOP, "Stop");
1204
 
    AppendMenu(gui->submenu, MF_STRING, ID_NTRACK, "Next Track");
1205
 
    AppendMenu(gui->submenu, MF_STRING, ID_SEEKF, "Seek Forwards");
1206
 
    AppendMenu(gui->submenu, MF_SEPARATOR, 0, 0);
1207
 
    AppendMenu(gui->submenu, MF_STRING, ID_FULLSCREEN, "Toggle Fullscreen");
1208
 
    AppendMenu(gui->submenu, MF_STRING, ID_MUTE, "Toggle Mute");
1209
 
    AppendMenu(gui->submenu, MF_SEPARATOR, 0, 0);
1210
 
    AppendMenu(gui->submenu, MF_STRING | MF_POPUP, (UINT) gui->aspectmenu, "Aspect Ratio");
1211
 
    AppendMenu(gui->submenu, MF_STRING | MF_POPUP, (UINT) gui->subtitlemenu, "Subtitle Options");
1212
 
    AppendMenu(gui->submenu, MF_STRING | MF_POPUP, (UINT) gui->dvdmenu, "DVD Options");
 
1239
    AppendMenu(gui->submenu, MF_STRING | MF_POPUP, (UINT_PTR) gui->trayplaymenu, acp(MSGTR_MENU_Open));
 
1240
    AppendMenu(gui->submenu, MF_SEPARATOR, 0, 0);
 
1241
    AppendMenu(gui->submenu, MF_STRING, ID_SEEKB, acp(MSGTR_MENU_SeekBack));
 
1242
    AppendMenu(gui->submenu, MF_STRING, ID_PTRACK, acp(MSGTR_MENU_PrevStream));
 
1243
    AppendMenu(gui->submenu, MF_STRING, ID_PLAY, acp(MSGTR_MENU_Play "/" MSGTR_MENU_Pause));
 
1244
    AppendMenu(gui->submenu, MF_STRING, ID_STOP, acp(MSGTR_MENU_Stop));
 
1245
    AppendMenu(gui->submenu, MF_STRING, ID_NTRACK, acp(MSGTR_MENU_NextStream));
 
1246
    AppendMenu(gui->submenu, MF_STRING, ID_SEEKF, acp(MSGTR_MENU_SeekForw));
 
1247
    AppendMenu(gui->submenu, MF_SEPARATOR, 0, 0);
 
1248
    AppendMenu(gui->submenu, MF_STRING, ID_FULLSCREEN, acp(MSGTR_MENU_FullScreen));
 
1249
    AppendMenu(gui->submenu, MF_STRING, ID_MUTE, acp(MSGTR_MENU_Mute));
 
1250
    AppendMenu(gui->submenu, MF_SEPARATOR, 0, 0);
 
1251
    AppendMenu(gui->submenu, MF_STRING | MF_POPUP, (UINT_PTR) gui->aspectmenu, acp(MSGTR_MENU_AspectRatio));
 
1252
    AppendMenu(gui->submenu, MF_STRING | MF_POPUP, (UINT_PTR) gui->subtitlemenu, acp(MSGTR_MENU_Subtitles));
 
1253
    AppendMenu(gui->submenu, MF_STRING | MF_POPUP, (UINT_PTR) gui->dvdmenu, acp(MSGTR_MENU_DVD));
1213
1254
#ifdef CONFIG_DVDREAD
1214
 
    AppendMenu(gui->dvdmenu, MF_STRING | MF_GRAYED, ID_CHAPTERSEL, "Select Title/Chapter...");
 
1255
    AppendMenu(gui->dvdmenu, MF_STRING | MF_GRAYED, ID_CHAPTERSEL, acp(MSGTR_SelectTitleChapter));
1215
1256
#endif
1216
 
    AppendMenu(gui->subtitlemenu, MF_STRING, IDSUB_TOGGLE, "Subtitle Visibility On/Off");
1217
 
    AppendMenu(gui->subtitlemenu, MF_STRING, IDSUB_CYCLE, "Cycle Subtitle Languages");
1218
 
    AppendMenu(gui->aspectmenu, MF_STRING, ID_ASPECT1, "Set 16:9");
1219
 
    AppendMenu(gui->aspectmenu, MF_STRING, ID_ASPECT2, "Set 4:3");
1220
 
    AppendMenu(gui->aspectmenu, MF_STRING, ID_ASPECT3, "Set 2.35");
 
1257
    AppendMenu(gui->subtitlemenu, MF_STRING, IDSUB_TOGGLE, acp(MSGTR_MENU_SubtitlesOnOff));
 
1258
    AppendMenu(gui->subtitlemenu, MF_STRING, IDSUB_CYCLE, acp(MSGTR_MENU_SubtitleLanguages));
 
1259
    AppendMenu(gui->aspectmenu, MF_STRING, ID_ASPECT1, "16:9");
 
1260
    AppendMenu(gui->aspectmenu, MF_STRING, ID_ASPECT2, "4:3");
 
1261
    AppendMenu(gui->aspectmenu, MF_STRING, ID_ASPECT3, "2.35");
1221
1262
    AppendMenu(gui->aspectmenu, MF_SEPARATOR, 0, 0);
1222
 
    AppendMenu(gui->aspectmenu, MF_STRING, ID_ASPECT4, "Original Aspect");
 
1263
    AppendMenu(gui->aspectmenu, MF_STRING, ID_ASPECT4, acp(MSGTR_MENU_Original));
1223
1264
    AppendMenu(gui->submenu, MF_SEPARATOR, 0, 0);
1224
 
    AppendMenu(gui->submenu, MF_STRING, IDEXIT, "&Exit");
 
1265
    AppendMenu(gui->submenu, MF_STRING, IDEXIT, acp(MSGTR_MENU_Exit));
1225
1266
}
1226
1267
 
1227
1268
static void maketransparent(HWND hwnd, COLORREF crTransparent)
1228
1269
{
1229
1270
    HDC mdc = GetDC(hwnd);
1230
 
    RECT rd;
 
1271
    RECT wrd, crd;
1231
1272
    HRGN crRgnres, crRgn, crRgnTmp;
1232
1273
    int iX = 0, iY = 0, iLeftX = 0;
 
1274
    int border, title;
1233
1275
    int width, height;
1234
 
    GetWindowRect(hwnd, &rd);
1235
 
    width = rd.right - rd.left;
1236
 
    height = rd.bottom - rd.top;
1237
 
 
1238
 
    /* create an empty region */
1239
 
    crRgn = CreateRectRgn(0, 0, 0, 0);
 
1276
 
 
1277
    GetWindowRect(hwnd, &wrd);
 
1278
    GetClientRect(hwnd, &crd);
 
1279
 
 
1280
    border = (wrd.right - wrd.left - crd.right) / 2;
 
1281
    title = (wrd.bottom - wrd.top - crd.bottom) - border;
 
1282
 
 
1283
    width = crd.right - crd.left;
 
1284
    height = crd.bottom - crd.top;
 
1285
 
 
1286
    /* create the title bar region */
 
1287
    crRgn = CreateRectRgn(0, 0, width + border + border, title);
1240
1288
 
1241
1289
    /* Create a region from a bitmap with transparency colour of Purple */
1242
1290
    for (iY = -1; iY < height; iY++)
1249
1297
            /* remember this pixel */
1250
1298
            iLeftX = iX;
1251
1299
 
1252
 
            /* now find first non transparent pixel */
 
1300
            /* now find last non transparent pixel */
1253
1301
            while (iX <= width && GetPixel(mdc,iX, iY) != crTransparent) ++iX;
1254
1302
 
1255
1303
            /* create a temp region on this info */
1256
 
            crRgnTmp = CreateRectRgn(iLeftX, iY, iX, iY+1);
 
1304
            crRgnTmp = CreateRectRgn(iLeftX + border, iY + title, iX + border, iY + title + 1);
1257
1305
 
1258
1306
            /* combine into main region */
1259
1307
            crRgnres = crRgn;
1265
1313
        } while (iX < width);
1266
1314
        iX = 0;
1267
1315
    }
 
1316
 
 
1317
    /* left border region */
 
1318
    crRgnTmp = CreateRectRgn(0, title, border, title + height);
 
1319
    CombineRgn(crRgn, crRgn, crRgnTmp, RGN_OR);
 
1320
    DeleteObject(crRgnTmp);
 
1321
 
 
1322
    /* right border region */
 
1323
    crRgnTmp = CreateRectRgn(width + border, title, width + border + border, title + height);
 
1324
    CombineRgn(crRgn, crRgn, crRgnTmp, RGN_OR);
 
1325
    DeleteObject(crRgnTmp);
 
1326
 
 
1327
    /* bottom region */
 
1328
    crRgnTmp = CreateRectRgn(0, title + height, width + border + border, title + height + border);
 
1329
    CombineRgn(crRgn, crRgn, crRgnTmp, RGN_OR);
 
1330
    DeleteObject(crRgnTmp);
 
1331
 
1268
1332
    SetWindowRgn(hwnd, crRgn, TRUE);
1269
1333
    DeleteObject(crRgn);
1270
1334
    ReleaseDC(hwnd,mdc);
1273
1337
static int window_render(gui_t *gui, HWND hWnd, HDC hdc, window_priv_t *priv, window *desc, BITMAPINFO binfo)
1274
1338
{
1275
1339
    int i;
1276
 
    SetWindowLongPtr(hWnd, GWLP_USERDATA, (DWORD) gui);
 
1340
    SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR) gui);
1277
1341
    (gui->window_priv_count)++;
1278
1342
    gui->window_priv = realloc(gui->window_priv, sizeof(window_priv_t *) * gui->window_priv_count);
1279
1343
    priv = gui->window_priv[gui->window_priv_count - 1] = calloc(1, sizeof(window_priv_t));
1310
1374
}
1311
1375
 
1312
1376
/* creates the sub (AKA video) window,*/
1313
 
int create_subwindow(gui_t *gui, char *skindir)
 
1377
int create_subwindow(gui_t *gui)
1314
1378
{
1315
1379
    HINSTANCE instance = GetModuleHandle(NULL);
1316
1380
    WNDCLASS wc;
1344
1408
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
1345
1409
    wc.hIcon = gui->icon;
1346
1410
    wc.hbrBackground = NULL; //WM_PAINT will handle background color switching;
1347
 
    wc.lpszClassName = "MPlayer Sub for Windows";
 
1411
    wc.lpszClassName = "MPlayer - Video";
1348
1412
    wc.lpszMenuName = NULL;
1349
1413
    RegisterClass(&wc);
1350
1414
 
1372
1436
    if (y <= -1 || (y+(rect.bottom-rect.top) > GetSystemMetrics(SM_CYSCREEN)))
1373
1437
        y = x;
1374
1438
 
1375
 
    hWnd = CreateWindowEx(0, "MPlayer Sub for Windows", "MPlayer for Windows", style,
 
1439
    hWnd = CreateWindowEx(0, "MPlayer - Video", "MPlayer - Video", style,
1376
1440
                          x, y, rect.right-rect.left, rect.bottom-rect.top,
1377
1441
                          gui->subwindow, NULL, instance, NULL);
1378
1442
 
1451
1515
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
1452
1516
    wc.hIcon = gui->icon;
1453
1517
    wc.hbrBackground = CreateSolidBrush(RGB(0, 0, 0));
1454
 
    wc.lpszClassName = gui->classname = "MPlayer GUI for Windows";
 
1518
    wc.lpszClassName = gui->classname = "MPlayer";
1455
1519
    wc.lpszMenuName = NULL;
1456
1520
    RegisterClass(&wc);
1457
1521
 
1487
1551
        gui_main_pos_y = y;
1488
1552
    }
1489
1553
 
1490
 
    hwnd = CreateWindowEx(0, gui->classname, "MPlayer for Windows", style,
 
1554
    hwnd = CreateWindowEx(0, gui->classname, "MPlayer", style,
1491
1555
                          x, y, rect.right-rect.left, rect.bottom-rect.top,
1492
1556
                          gui->mainwindow, NULL, instance, NULL);
1493
1557
 
1498
1562
    nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
1499
1563
    nid.uCallbackMessage = WM_SYSTRAY;
1500
1564
    nid.hIcon = gui->icon;
1501
 
    strcpy(nid.szTip, "MPlayer for Windows");
 
1565
    strcpy(nid.szTip, "MPlayer");
1502
1566
 
1503
1567
    /* register the systray icon */
1504
1568
    Shell_NotifyIcon(NIM_ADD, &nid);
1519
1583
    return 0;
1520
1584
}
1521
1585
 
1522
 
gui_t *create_gui(char *skindir, char *skinName, void (*playercontrol)(int event))
 
1586
gui_t *create_gui(char *skindir, void (*playercontrol)(int event))
1523
1587
{
1524
1588
    gui_t *gui = calloc(1, sizeof(gui_t));
1525
1589
    char temp[MAX_PATH];
1526
 
    HWND runningmplayer = FindWindow("MPlayer GUI for Windows", "MPlayer for Windows");
 
1590
    HWND runningmplayer = FindWindow("MPlayer", "MPlayer");
1527
1591
 
1528
1592
    if(runningmplayer)
1529
1593
    {
1539
1603
    /* create playlist */
1540
1604
    gui->playlist = create_playlist();
1541
1605
 
1542
 
    if(!skinName) skinName = strdup("Blue");
1543
 
    sprintf(temp, "%s\\%s", skindir, skinName);
 
1606
    sprintf(temp, "%s/%s", skindir, skinName);
1544
1607
    if(create_window(gui, temp)) return NULL;
1545
 
    if(create_subwindow(gui, temp)) return NULL;
 
1608
    if(create_subwindow(gui)) return NULL;
1546
1609
    if(console) console_toggle();
1547
1610
    return gui;
1548
1611
}