win: Remove menu code from win_stbar.c
This commit is contained in:
@@ -58,16 +58,12 @@ extern int ui_sb_find_part(int tag);
|
|||||||
extern void ui_sb_set_ready(int ready);
|
extern void ui_sb_set_ready(int ready);
|
||||||
extern void ui_sb_update_panes(void);
|
extern void ui_sb_update_panes(void);
|
||||||
extern void ui_sb_update_tip(int meaning);
|
extern void ui_sb_update_tip(int meaning);
|
||||||
extern void ui_sb_check_menu_item(int tag, int id, int chk);
|
|
||||||
extern void ui_sb_enable_menu_item(int tag, int id, int val);
|
|
||||||
extern void ui_sb_timer_callback(int pane);
|
extern void ui_sb_timer_callback(int pane);
|
||||||
extern void ui_sb_update_icon(int tag, int val);
|
extern void ui_sb_update_icon(int tag, int val);
|
||||||
extern void ui_sb_update_icon_state(int tag, int active);
|
extern void ui_sb_update_icon_state(int tag, int active);
|
||||||
extern void ui_sb_set_text_w(wchar_t *wstr);
|
extern void ui_sb_set_text_w(wchar_t *wstr);
|
||||||
extern void ui_sb_set_text(char *str);
|
extern void ui_sb_set_text(char *str);
|
||||||
extern void ui_sb_bugui(char *str);
|
extern void ui_sb_bugui(char *str);
|
||||||
extern void ui_sb_mount_floppy_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name);
|
|
||||||
extern void ui_sb_mount_zip_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@@ -62,8 +62,6 @@ int update_icons = 1;
|
|||||||
|
|
||||||
|
|
||||||
static LONG_PTR OriginalProcedure;
|
static LONG_PTR OriginalProcedure;
|
||||||
static HMENU *sb_menu_handles;
|
|
||||||
static HMENU menuSBAR;
|
|
||||||
static WCHAR **sbTips;
|
static WCHAR **sbTips;
|
||||||
static int *iStatusWidths;
|
static int *iStatusWidths;
|
||||||
static int *sb_part_meanings;
|
static int *sb_part_meanings;
|
||||||
@@ -72,10 +70,6 @@ static int sb_parts = 0;
|
|||||||
static int sb_ready = 0;
|
static int sb_ready = 0;
|
||||||
static uint8_t sb_map[256];
|
static uint8_t sb_map[256];
|
||||||
|
|
||||||
static HMENU hmenuMedia;
|
|
||||||
static HMENU *media_menu_handles;
|
|
||||||
|
|
||||||
|
|
||||||
/* Also used by win_settings.c */
|
/* Also used by win_settings.c */
|
||||||
intptr_t
|
intptr_t
|
||||||
fdd_type_to_icon(int type)
|
fdd_type_to_icon(int type)
|
||||||
@@ -120,107 +114,6 @@ hdd_count(int bus)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
StatusBarCreateFloppySubmenu(HMENU m, int id)
|
|
||||||
{
|
|
||||||
AppendMenu(m, MF_STRING, IDM_FLOPPY_IMAGE_NEW | id,
|
|
||||||
plat_get_string(IDS_2096));
|
|
||||||
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
|
||||||
AppendMenu(m, MF_STRING, IDM_FLOPPY_IMAGE_EXISTING | id,
|
|
||||||
plat_get_string(IDS_2097));
|
|
||||||
AppendMenu(m, MF_STRING, IDM_FLOPPY_IMAGE_EXISTING_WP | id,
|
|
||||||
plat_get_string(IDS_2098));
|
|
||||||
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
|
||||||
AppendMenu(m, MF_STRING, IDM_FLOPPY_EXPORT_TO_86F | id,
|
|
||||||
plat_get_string(IDS_2080));
|
|
||||||
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
|
||||||
AppendMenu(m, MF_STRING, IDM_FLOPPY_EJECT | id,
|
|
||||||
plat_get_string(IDS_2093));
|
|
||||||
|
|
||||||
if (floppyfns[id][0] == 0x0000) {
|
|
||||||
EnableMenuItem(m, IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
|
|
||||||
EnableMenuItem(m, IDM_FLOPPY_EXPORT_TO_86F | id, MF_BYCOMMAND | MF_GRAYED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
StatusBarCreateCdromSubmenu(HMENU m, int id)
|
|
||||||
{
|
|
||||||
AppendMenu(m, MF_STRING, IDM_CDROM_MUTE | id,
|
|
||||||
plat_get_string(IDS_2092));
|
|
||||||
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
|
||||||
AppendMenu(m, MF_STRING, IDM_CDROM_EMPTY | id,
|
|
||||||
plat_get_string(IDS_2091));
|
|
||||||
AppendMenu(m, MF_STRING, IDM_CDROM_RELOAD | id,
|
|
||||||
plat_get_string(IDS_2090));
|
|
||||||
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
|
||||||
AppendMenu(m, MF_STRING, IDM_CDROM_IMAGE | id,
|
|
||||||
plat_get_string(IDS_2089));
|
|
||||||
|
|
||||||
if (! cdrom[id].sound_on)
|
|
||||||
CheckMenuItem(m, IDM_CDROM_MUTE | id, MF_CHECKED);
|
|
||||||
|
|
||||||
if (cdrom[id].host_drive == 200)
|
|
||||||
CheckMenuItem(m, IDM_CDROM_IMAGE | id, MF_CHECKED);
|
|
||||||
else {
|
|
||||||
cdrom[id].host_drive = 0;
|
|
||||||
CheckMenuItem(m, IDM_CDROM_EMPTY | id, MF_CHECKED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
StatusBarCreateZIPSubmenu(HMENU m, int id)
|
|
||||||
{
|
|
||||||
AppendMenu(m, MF_STRING, IDM_ZIP_IMAGE_NEW | id,
|
|
||||||
plat_get_string(IDS_2096));
|
|
||||||
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
|
||||||
AppendMenu(m, MF_STRING, IDM_ZIP_IMAGE_EXISTING | id,
|
|
||||||
plat_get_string(IDS_2097));
|
|
||||||
AppendMenu(m, MF_STRING, IDM_ZIP_IMAGE_EXISTING_WP | id,
|
|
||||||
plat_get_string(IDS_2098));
|
|
||||||
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
|
||||||
AppendMenu(m, MF_STRING, IDM_ZIP_EJECT | id,
|
|
||||||
plat_get_string(IDS_2093));
|
|
||||||
AppendMenu(m, MF_STRING, IDM_ZIP_RELOAD | id,
|
|
||||||
plat_get_string(IDS_2090));
|
|
||||||
|
|
||||||
if (zip_drives[id].image_path[0] == 0x0000) {
|
|
||||||
EnableMenuItem(m, IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
|
|
||||||
EnableMenuItem(m, IDM_ZIP_RELOAD | id, MF_BYCOMMAND | MF_ENABLED);
|
|
||||||
} else {
|
|
||||||
EnableMenuItem(m, IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_ENABLED);
|
|
||||||
EnableMenuItem(m, IDM_ZIP_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
StatusBarCreateMOSubmenu(HMENU m, int id)
|
|
||||||
{
|
|
||||||
AppendMenu(m, MF_STRING, IDM_MO_IMAGE_NEW | id,
|
|
||||||
plat_get_string(IDS_2096));
|
|
||||||
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
|
||||||
AppendMenu(m, MF_STRING, IDM_MO_IMAGE_EXISTING | id,
|
|
||||||
plat_get_string(IDS_2097));
|
|
||||||
AppendMenu(m, MF_STRING, IDM_MO_IMAGE_EXISTING_WP | id,
|
|
||||||
plat_get_string(IDS_2098));
|
|
||||||
AppendMenu(m, MF_SEPARATOR, 0, 0);
|
|
||||||
AppendMenu(m, MF_STRING, IDM_MO_EJECT | id,
|
|
||||||
plat_get_string(IDS_2093));
|
|
||||||
AppendMenu(m, MF_STRING, IDM_MO_RELOAD | id,
|
|
||||||
plat_get_string(IDS_2090));
|
|
||||||
|
|
||||||
if (mo_drives[id].image_path[0] == 0x0000) {
|
|
||||||
EnableMenuItem(m, IDM_MO_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
|
|
||||||
EnableMenuItem(m, IDM_MO_RELOAD | id, MF_BYCOMMAND | MF_ENABLED);
|
|
||||||
} else {
|
|
||||||
EnableMenuItem(m, IDM_MO_EJECT | id, MF_BYCOMMAND | MF_ENABLED);
|
|
||||||
EnableMenuItem(m, IDM_MO_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ui_sb_timer_callback(int pane)
|
ui_sb_timer_callback(int pane)
|
||||||
{
|
{
|
||||||
@@ -486,54 +379,10 @@ ui_sb_update_tip(int meaning)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SendMessage(hwndSBAR, SB_SETTIPTEXT, part, (LPARAM)sbTips[part]);
|
SendMessage(hwndSBAR, SB_SETTIPTEXT, part, (LPARAM)sbTips[part]);
|
||||||
ModifyMenu(hmenuMedia, part, MF_BYPOSITION, (UINT_PTR)media_menu_handles[part], sbTips[part]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
MediaMenuDestroyMenus(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (sb_parts == 0) return;
|
|
||||||
|
|
||||||
if (! media_menu_handles) return;
|
|
||||||
|
|
||||||
for (i=0; i<sb_parts; i++) {
|
|
||||||
if (media_menu_handles[i]) {
|
|
||||||
RemoveMenu(hmenuMedia, (UINT_PTR)media_menu_handles[i], MF_BYCOMMAND);
|
|
||||||
DestroyMenu(media_menu_handles[i]);
|
|
||||||
media_menu_handles[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
free(media_menu_handles);
|
|
||||||
media_menu_handles = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
StatusBarDestroyMenus(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (sb_parts == 0) return;
|
|
||||||
|
|
||||||
if (! sb_menu_handles) return;
|
|
||||||
|
|
||||||
for (i=0; i<sb_parts; i++) {
|
|
||||||
if (sb_menu_handles[i]) {
|
|
||||||
DestroyMenu(sb_menu_handles[i]);
|
|
||||||
sb_menu_handles[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
free(sb_menu_handles);
|
|
||||||
sb_menu_handles = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
StatusBarDestroyTips(void)
|
StatusBarDestroyTips(void)
|
||||||
{
|
{
|
||||||
@@ -555,30 +404,6 @@ StatusBarDestroyTips(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static HMENU
|
|
||||||
MediaMenuCreatePopupMenu(int part)
|
|
||||||
{
|
|
||||||
HMENU h;
|
|
||||||
|
|
||||||
h = CreatePopupMenu();
|
|
||||||
AppendMenu(hmenuMedia, MF_POPUP | MF_STRING, (UINT_PTR)h, 0);
|
|
||||||
|
|
||||||
return(h);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static HMENU
|
|
||||||
StatusBarCreatePopupMenu(int part)
|
|
||||||
{
|
|
||||||
HMENU h;
|
|
||||||
|
|
||||||
h = CreatePopupMenu();
|
|
||||||
AppendMenu(menuSBAR, MF_POPUP, (UINT_PTR)h, 0);
|
|
||||||
|
|
||||||
return(h);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* API: mark the status bar as not ready. */
|
/* API: mark the status bar as not ready. */
|
||||||
void
|
void
|
||||||
ui_sb_set_ready(int ready)
|
ui_sb_set_ready(int ready)
|
||||||
@@ -632,9 +457,7 @@ ui_sb_update_panes(void)
|
|||||||
free(sb_part_icons);
|
free(sb_part_icons);
|
||||||
sb_part_icons = NULL;
|
sb_part_icons = NULL;
|
||||||
}
|
}
|
||||||
StatusBarDestroyMenus();
|
|
||||||
StatusBarDestroyTips();
|
StatusBarDestroyTips();
|
||||||
MediaMenuDestroyMenus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(sb_map, 0xff, sizeof(sb_map));
|
memset(sb_map, 0xff, sizeof(sb_map));
|
||||||
@@ -693,12 +516,8 @@ ui_sb_update_panes(void)
|
|||||||
memset(sb_part_meanings, 0, sb_parts * sizeof(int));
|
memset(sb_part_meanings, 0, sb_parts * sizeof(int));
|
||||||
sb_part_icons = (uint8_t *)malloc(sb_parts * sizeof(uint8_t));
|
sb_part_icons = (uint8_t *)malloc(sb_parts * sizeof(uint8_t));
|
||||||
memset(sb_part_icons, 0, sb_parts * sizeof(uint8_t));
|
memset(sb_part_icons, 0, sb_parts * sizeof(uint8_t));
|
||||||
sb_menu_handles = (HMENU *)malloc(sb_parts * sizeof(HMENU));
|
|
||||||
memset(sb_menu_handles, 0, sb_parts * sizeof(HMENU));
|
|
||||||
sbTips = (WCHAR **)malloc(sb_parts * sizeof(WCHAR *));
|
sbTips = (WCHAR **)malloc(sb_parts * sizeof(WCHAR *));
|
||||||
memset(sbTips, 0, sb_parts * sizeof(WCHAR *));
|
memset(sbTips, 0, sb_parts * sizeof(WCHAR *));
|
||||||
media_menu_handles = (HMENU *)malloc(sb_parts * sizeof(HMENU));
|
|
||||||
memset(media_menu_handles, 0, sb_parts * sizeof(HMENU));
|
|
||||||
|
|
||||||
sb_parts = 0;
|
sb_parts = 0;
|
||||||
for (i=0; i<FDD_NUM; i++) {
|
for (i=0; i<FDD_NUM; i++) {
|
||||||
@@ -819,16 +638,7 @@ ui_sb_update_panes(void)
|
|||||||
case SB_FLOPPY: /* Floppy */
|
case SB_FLOPPY: /* Floppy */
|
||||||
sb_part_icons[i] = (wcslen(floppyfns[sb_part_meanings[i] & 0xf]) == 0) ? 128 : 0;
|
sb_part_icons[i] = (wcslen(floppyfns[sb_part_meanings[i] & 0xf]) == 0) ? 128 : 0;
|
||||||
sb_part_icons[i] |= fdd_type_to_icon(fdd_get_type(sb_part_meanings[i] & 0xf));
|
sb_part_icons[i] |= fdd_type_to_icon(fdd_get_type(sb_part_meanings[i] & 0xf));
|
||||||
sb_menu_handles[i] = StatusBarCreatePopupMenu(i);
|
|
||||||
media_menu_handles[i] = MediaMenuCreatePopupMenu(i);
|
|
||||||
|
|
||||||
StatusBarCreateFloppySubmenu(sb_menu_handles[i], sb_part_meanings[i] & 0xf);
|
|
||||||
StatusBarCreateFloppySubmenu(media_menu_handles[i], sb_part_meanings[i] & 0xf);
|
|
||||||
|
|
||||||
EnableMenuItem(sb_menu_handles[i], IDM_FLOPPY_EJECT | (sb_part_meanings[i] & 0xf), MF_BYCOMMAND | ((sb_part_icons[i] & 128) ? MF_GRAYED : MF_ENABLED));
|
|
||||||
EnableMenuItem(media_menu_handles[i], IDM_FLOPPY_EJECT | (sb_part_meanings[i] & 0xf), MF_BYCOMMAND | ((sb_part_icons[i] & 128) ? MF_GRAYED : MF_ENABLED));
|
|
||||||
StatusBarCreateFloppyTip(i);
|
StatusBarCreateFloppyTip(i);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_CDROM: /* CD-ROM */
|
case SB_CDROM: /* CD-ROM */
|
||||||
@@ -838,46 +648,19 @@ ui_sb_update_panes(void)
|
|||||||
else
|
else
|
||||||
sb_part_icons[i] = 128;
|
sb_part_icons[i] = 128;
|
||||||
sb_part_icons[i] |= 32;
|
sb_part_icons[i] |= 32;
|
||||||
sb_menu_handles[i] = StatusBarCreatePopupMenu(i);
|
|
||||||
media_menu_handles[i] = MediaMenuCreatePopupMenu(i);
|
|
||||||
|
|
||||||
StatusBarCreateCdromSubmenu(sb_menu_handles[i], sb_part_meanings[i] & 0xf);
|
|
||||||
StatusBarCreateCdromSubmenu(media_menu_handles[i], sb_part_meanings[i] & 0xf);
|
|
||||||
|
|
||||||
EnableMenuItem(sb_menu_handles[i], IDM_CDROM_RELOAD | (sb_part_meanings[i] & 0xf), MF_BYCOMMAND | MF_GRAYED);
|
|
||||||
EnableMenuItem(media_menu_handles[i], IDM_CDROM_RELOAD | (sb_part_meanings[i] & 0xf), MF_BYCOMMAND | MF_GRAYED);
|
|
||||||
StatusBarCreateCdromTip(i);
|
StatusBarCreateCdromTip(i);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_ZIP: /* Iomega ZIP */
|
case SB_ZIP: /* Iomega ZIP */
|
||||||
sb_part_icons[i] = (wcslen(zip_drives[sb_part_meanings[i] & 0xf].image_path) == 0) ? 128 : 0;
|
sb_part_icons[i] = (wcslen(zip_drives[sb_part_meanings[i] & 0xf].image_path) == 0) ? 128 : 0;
|
||||||
sb_part_icons[i] |= 48;
|
sb_part_icons[i] |= 48;
|
||||||
sb_menu_handles[i] = StatusBarCreatePopupMenu(i);
|
|
||||||
media_menu_handles[i] = MediaMenuCreatePopupMenu(i);
|
|
||||||
|
|
||||||
StatusBarCreateZIPSubmenu(sb_menu_handles[i], sb_part_meanings[i] & 0xf);
|
|
||||||
StatusBarCreateZIPSubmenu(media_menu_handles[i], sb_part_meanings[i] & 0xf);
|
|
||||||
|
|
||||||
EnableMenuItem(sb_menu_handles[i], IDM_ZIP_EJECT | (sb_part_meanings[i] & 0xf), MF_BYCOMMAND | ((sb_part_icons[i] & 128) ? MF_GRAYED : MF_ENABLED));
|
|
||||||
EnableMenuItem(media_menu_handles[i], IDM_ZIP_EJECT | (sb_part_meanings[i] & 0xf), MF_BYCOMMAND | ((sb_part_icons[i] & 128) ? MF_GRAYED : MF_ENABLED));
|
|
||||||
StatusBarCreateZIPTip(i);
|
StatusBarCreateZIPTip(i);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_MO: /* Magneto-Optical disk */
|
case SB_MO: /* Magneto-Optical disk */
|
||||||
sb_part_icons[i] = (wcslen(mo_drives[sb_part_meanings[i] & 0xf].image_path) == 0) ? 128 : 0;
|
sb_part_icons[i] = (wcslen(mo_drives[sb_part_meanings[i] & 0xf].image_path) == 0) ? 128 : 0;
|
||||||
sb_part_icons[i] |= 56;
|
sb_part_icons[i] |= 56;
|
||||||
sb_menu_handles[i] = StatusBarCreatePopupMenu(i);
|
|
||||||
media_menu_handles[i] = MediaMenuCreatePopupMenu(i);
|
|
||||||
|
|
||||||
StatusBarCreateMOSubmenu(sb_menu_handles[i], sb_part_meanings[i] & 0xf);
|
|
||||||
StatusBarCreateMOSubmenu(media_menu_handles[i], sb_part_meanings[i] & 0xf);
|
|
||||||
|
|
||||||
EnableMenuItem(sb_menu_handles[i], IDM_MO_EJECT | (sb_part_meanings[i] & 0xf), MF_BYCOMMAND | ((sb_part_icons[i] & 128) ? MF_GRAYED : MF_ENABLED));
|
|
||||||
EnableMenuItem(media_menu_handles[i], IDM_MO_EJECT | (sb_part_meanings[i] & 0xf), MF_BYCOMMAND | ((sb_part_icons[i] & 128) ? MF_GRAYED : MF_ENABLED));
|
|
||||||
StatusBarCreateMOTip(i);
|
StatusBarCreateMOTip(i);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_HDD: /* Hard disk */
|
case SB_HDD: /* Hard disk */
|
||||||
@@ -905,7 +688,6 @@ ui_sb_update_panes(void)
|
|||||||
SendMessage(hwndSBAR, SB_SETTEXT, i | SBT_NOBORDERS, (LPARAM)L"");
|
SendMessage(hwndSBAR, SB_SETTEXT, i | SBT_NOBORDERS, (LPARAM)L"");
|
||||||
SendMessage(hwndSBAR, SB_SETICON, i, (LPARAM)hIcon[sb_part_icons[i]]);
|
SendMessage(hwndSBAR, SB_SETICON, i, (LPARAM)hIcon[sb_part_icons[i]]);
|
||||||
SendMessage(hwndSBAR, SB_SETTIPTEXT, i, (LPARAM)sbTips[i]);
|
SendMessage(hwndSBAR, SB_SETTIPTEXT, i, (LPARAM)sbTips[i]);
|
||||||
ModifyMenu(hmenuMedia, i, MF_BYPOSITION, (UINT_PTR)media_menu_handles[i], sbTips[i]);
|
|
||||||
} else
|
} else
|
||||||
SendMessage(hwndSBAR, SB_SETICON, i, (LPARAM)NULL);
|
SendMessage(hwndSBAR, SB_SETICON, i, (LPARAM)NULL);
|
||||||
}
|
}
|
||||||
@@ -948,249 +730,6 @@ StatusBarPopupMenu(HWND hwnd, POINT pt, int id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ui_sb_mount_floppy_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name)
|
|
||||||
{
|
|
||||||
fdd_close(id);
|
|
||||||
ui_writeprot[id] = wp;
|
|
||||||
fdd_load(id, file_name);
|
|
||||||
if (sb_ready) {
|
|
||||||
ui_sb_update_icon_state(SB_FLOPPY | id, wcslen(floppyfns[id]) ? 0 : 1);
|
|
||||||
ui_sb_enable_menu_item(SB_FLOPPY | id, IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | (wcslen(floppyfns[id]) ? MF_ENABLED : MF_GRAYED));
|
|
||||||
ui_sb_enable_menu_item(SB_FLOPPY | id, IDM_FLOPPY_EXPORT_TO_86F | id, MF_BYCOMMAND | (wcslen(floppyfns[id]) ? MF_ENABLED : MF_GRAYED));
|
|
||||||
ui_sb_update_tip(SB_FLOPPY | id);
|
|
||||||
}
|
|
||||||
config_save();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
ui_sb_mount_zip_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name)
|
|
||||||
{
|
|
||||||
zip_t *dev = (zip_t *) zip_drives[id].priv;
|
|
||||||
|
|
||||||
zip_disk_close(dev);
|
|
||||||
zip_drives[id].read_only = wp;
|
|
||||||
zip_load(dev, file_name);
|
|
||||||
zip_insert(dev);
|
|
||||||
if (sb_ready) {
|
|
||||||
ui_sb_update_icon_state(SB_ZIP | id, wcslen(zip_drives[id].image_path) ? 0 : 1);
|
|
||||||
ui_sb_enable_menu_item(SB_ZIP | id, IDM_ZIP_EJECT | id, MF_BYCOMMAND | (wcslen(zip_drives[id].image_path) ? MF_ENABLED : MF_GRAYED));
|
|
||||||
ui_sb_enable_menu_item(SB_ZIP | id, IDM_ZIP_RELOAD | id, MF_BYCOMMAND | (wcslen(zip_drives[id].image_path) ? MF_GRAYED : MF_ENABLED));
|
|
||||||
ui_sb_update_tip(SB_ZIP | id);
|
|
||||||
}
|
|
||||||
config_save();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ui_sb_mount_mo_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name)
|
|
||||||
{
|
|
||||||
mo_t *dev = (mo_t *) mo_drives[id].priv;
|
|
||||||
|
|
||||||
mo_disk_close(dev);
|
|
||||||
mo_drives[id].read_only = wp;
|
|
||||||
mo_load(dev, file_name);
|
|
||||||
mo_insert(dev);
|
|
||||||
if (sb_ready) {
|
|
||||||
ui_sb_update_icon_state(SB_MO | id, wcslen(mo_drives[id].image_path) ? 0 : 1);
|
|
||||||
ui_sb_enable_menu_item(SB_MO | id, IDM_MO_EJECT | id, MF_BYCOMMAND | (wcslen(zip_drives[id].image_path) ? MF_ENABLED : MF_GRAYED));
|
|
||||||
ui_sb_enable_menu_item(SB_MO | id, IDM_MO_RELOAD | id, MF_BYCOMMAND | (wcslen(zip_drives[id].image_path) ? MF_GRAYED : MF_ENABLED));
|
|
||||||
ui_sb_update_tip(SB_MO | id);
|
|
||||||
}
|
|
||||||
config_save();
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
MediaMenuHandler(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
||||||
{
|
|
||||||
int id = 0, ret = 0;
|
|
||||||
uint8_t part = 0;
|
|
||||||
WCHAR temp_path[1024];
|
|
||||||
int item_id, item_params;
|
|
||||||
|
|
||||||
item_id = LOWORD(wParam) & 0xff00; /* low 8 bits */
|
|
||||||
item_params = LOWORD(wParam) & 0x00ff; /* high 8 bits */
|
|
||||||
|
|
||||||
switch (item_id) {
|
|
||||||
case IDM_FLOPPY_IMAGE_NEW:
|
|
||||||
id = item_params & 0x0003;
|
|
||||||
part = sb_map[SB_FLOPPY | id];
|
|
||||||
if ((part == 0xff) || (sb_menu_handles == NULL))
|
|
||||||
break;
|
|
||||||
|
|
||||||
NewFloppyDialogCreate(hwnd, id, part);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDM_FLOPPY_IMAGE_EXISTING:
|
|
||||||
case IDM_FLOPPY_IMAGE_EXISTING_WP:
|
|
||||||
id = item_params & 0x0003;
|
|
||||||
part = sb_map[SB_FLOPPY | id];
|
|
||||||
if ((part == 0xff) || (sb_menu_handles == NULL))
|
|
||||||
break;
|
|
||||||
|
|
||||||
ret = file_dlg_w_st(hwnd, IDS_2118, floppyfns[id], 0);
|
|
||||||
if (! ret)
|
|
||||||
ui_sb_mount_floppy_img(id, part, (item_id == IDM_FLOPPY_IMAGE_EXISTING_WP) ? 1 : 0, wopenfilestring);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDM_FLOPPY_EJECT:
|
|
||||||
id = item_params & 0x0003;
|
|
||||||
part = sb_map[SB_FLOPPY | id];
|
|
||||||
if ((part == 0xff) || (sb_menu_handles == NULL))
|
|
||||||
break;
|
|
||||||
|
|
||||||
fdd_close(id);
|
|
||||||
ui_sb_update_icon_state(SB_FLOPPY | id, 1);
|
|
||||||
ui_sb_enable_menu_item(SB_FLOPPY | id, IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
|
|
||||||
ui_sb_enable_menu_item(SB_FLOPPY | id, IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
|
|
||||||
ui_sb_update_tip(SB_FLOPPY | id);
|
|
||||||
config_save();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDM_FLOPPY_EXPORT_TO_86F:
|
|
||||||
id = item_params & 0x0003;
|
|
||||||
part = sb_map[SB_FLOPPY | id];
|
|
||||||
if ((part == 0xff) || (sb_menu_handles == NULL))
|
|
||||||
break;
|
|
||||||
|
|
||||||
ret = file_dlg_w_st(hwnd, IDS_2076, floppyfns[id], 1);
|
|
||||||
if (! ret) {
|
|
||||||
plat_pause(1);
|
|
||||||
ret = d86f_export(id, wopenfilestring);
|
|
||||||
if (!ret)
|
|
||||||
ui_msgbox(MBX_ERROR, (wchar_t *)IDS_4108);
|
|
||||||
plat_pause(0);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDM_CDROM_MUTE:
|
|
||||||
id = item_params & 0x0007;
|
|
||||||
part = sb_map[SB_CDROM | id];
|
|
||||||
if ((part == 0xff) || (sb_menu_handles == NULL))
|
|
||||||
break;
|
|
||||||
|
|
||||||
cdrom[id].sound_on ^= 1;
|
|
||||||
ui_sb_check_menu_item(SB_CDROM | id, IDM_CDROM_MUTE | id, cdrom[id].sound_on ? MF_UNCHECKED : MF_CHECKED);
|
|
||||||
config_save();
|
|
||||||
sound_cd_thread_reset();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDM_CDROM_EMPTY:
|
|
||||||
id = item_params & 0x0007;
|
|
||||||
part = sb_map[SB_CDROM | id];
|
|
||||||
if ((part == 0xff) || (sb_menu_handles == NULL))
|
|
||||||
break;
|
|
||||||
|
|
||||||
cdrom_eject(id);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDM_CDROM_RELOAD:
|
|
||||||
id = item_params & 0x0007;
|
|
||||||
part = sb_map[SB_CDROM | id];
|
|
||||||
if ((part == 0xff) || (sb_menu_handles == NULL))
|
|
||||||
break;
|
|
||||||
|
|
||||||
cdrom_reload(id);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDM_CDROM_IMAGE:
|
|
||||||
id = item_params & 0x0007;
|
|
||||||
part = sb_map[SB_CDROM | id];
|
|
||||||
if ((part == 0xff) || (sb_menu_handles == NULL))
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (!file_dlg_w_st(hwnd, IDS_2075, cdrom[id].image_path, 0)) {
|
|
||||||
cdrom[id].prev_host_drive = cdrom[id].host_drive;
|
|
||||||
wcscpy(temp_path, wopenfilestring);
|
|
||||||
wcscpy(cdrom[id].prev_image_path, cdrom[id].image_path);
|
|
||||||
if (cdrom[id].ops && cdrom[id].ops->exit)
|
|
||||||
cdrom[id].ops->exit(&(cdrom[id]));
|
|
||||||
cdrom[id].ops = NULL;
|
|
||||||
memset(cdrom[id].image_path, 0, sizeof(cdrom[id].image_path));
|
|
||||||
cdrom_image_open(&(cdrom[id]), temp_path);
|
|
||||||
/* Signal media change to the emulated machine. */
|
|
||||||
if (cdrom[id].insert)
|
|
||||||
cdrom[id].insert(cdrom[id].priv);
|
|
||||||
cdrom[id].host_drive = (wcslen(cdrom[id].image_path) == 0) ? 0 : 200;
|
|
||||||
if (cdrom[id].host_drive == 200) {
|
|
||||||
ui_sb_check_menu_item(SB_CDROM | id, IDM_CDROM_EMPTY | id, MF_UNCHECKED);
|
|
||||||
ui_sb_check_menu_item(SB_CDROM | id, IDM_CDROM_IMAGE | id, MF_CHECKED);
|
|
||||||
ui_sb_update_icon_state(SB_CDROM | id, 0);
|
|
||||||
} else {
|
|
||||||
ui_sb_check_menu_item(SB_CDROM | id, IDM_CDROM_IMAGE | id, MF_UNCHECKED);
|
|
||||||
ui_sb_check_menu_item(SB_CDROM | id, IDM_CDROM_EMPTY | id, MF_CHECKED);
|
|
||||||
ui_sb_update_icon_state(SB_CDROM | id, 1);
|
|
||||||
}
|
|
||||||
ui_sb_enable_menu_item(SB_CDROM | id, IDM_CDROM_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
|
|
||||||
ui_sb_update_tip(SB_CDROM | id);
|
|
||||||
config_save();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDM_ZIP_IMAGE_NEW:
|
|
||||||
id = item_params & 0x0003;
|
|
||||||
part = sb_map[SB_ZIP | id];
|
|
||||||
NewFloppyDialogCreate(hwnd, id | 0x80, part); /* NewZIPDialogCreate */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDM_ZIP_IMAGE_EXISTING:
|
|
||||||
case IDM_ZIP_IMAGE_EXISTING_WP:
|
|
||||||
id = item_params & 0x0003;
|
|
||||||
part = sb_map[SB_ZIP | id];
|
|
||||||
if ((part == 0xff) || (sb_menu_handles == NULL))
|
|
||||||
break;
|
|
||||||
|
|
||||||
ret = file_dlg_w_st(hwnd, IDS_2058, zip_drives[id].image_path, 0);
|
|
||||||
if (! ret)
|
|
||||||
ui_sb_mount_zip_img(id, part, (item_id == IDM_ZIP_IMAGE_EXISTING_WP) ? 1 : 0, wopenfilestring);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDM_ZIP_EJECT:
|
|
||||||
id = item_params & 0x0003;
|
|
||||||
zip_eject(id);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDM_ZIP_RELOAD:
|
|
||||||
id = item_params & 0x0003;
|
|
||||||
zip_reload(id);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDM_MO_IMAGE_NEW:
|
|
||||||
id = item_params & 0x0003;
|
|
||||||
part = sb_map[SB_MO | id];
|
|
||||||
NewFloppyDialogCreate(hwnd, id | 0x80, part); /* NewZIPDialogCreate */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDM_MO_IMAGE_EXISTING:
|
|
||||||
case IDM_MO_IMAGE_EXISTING_WP:
|
|
||||||
id = item_params & 0x0003;
|
|
||||||
part = sb_map[SB_MO | id];
|
|
||||||
if ((part == 0xff) || (sb_menu_handles == NULL))
|
|
||||||
break;
|
|
||||||
|
|
||||||
ret = file_dlg_w_st(hwnd, IDS_2125, mo_drives[id].image_path, 0);
|
|
||||||
if (! ret)
|
|
||||||
ui_sb_mount_mo_img(id, part, (item_id == IDM_MO_IMAGE_EXISTING_WP) ? 1 : 0, wopenfilestring);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDM_MO_EJECT:
|
|
||||||
id = item_params & 0x0003;
|
|
||||||
mo_eject(id);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case IDM_MO_RELOAD:
|
|
||||||
id = item_params & 0x0003;
|
|
||||||
mo_reload(id);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Handle messages for the Status Bar window. */
|
/* Handle messages for the Status Bar window. */
|
||||||
#if defined(__amd64__) || defined(__aarch64__)
|
#if defined(__amd64__) || defined(__aarch64__)
|
||||||
static LRESULT CALLBACK
|
static LRESULT CALLBACK
|
||||||
@@ -1237,27 +776,6 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
MediaMenuCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
|
|
||||||
{
|
|
||||||
HMENU hmenu;
|
|
||||||
LPWSTR lpMenuName;
|
|
||||||
|
|
||||||
hmenu = GetMenu(hwndParent);
|
|
||||||
hmenuMedia = CreatePopupMenu();
|
|
||||||
|
|
||||||
int len = GetMenuString(hmenu, IDM_MEDIA, NULL, 0, MF_BYCOMMAND);
|
|
||||||
lpMenuName = malloc((len + 1) * sizeof(WCHAR));
|
|
||||||
GetMenuString(hmenu, IDM_MEDIA, lpMenuName, len + 1, MF_BYCOMMAND);
|
|
||||||
|
|
||||||
InsertMenu(hmenu, IDM_MEDIA, MF_BYCOMMAND | MF_STRING | MF_POPUP, (UINT_PTR)hmenuMedia, lpMenuName);
|
|
||||||
RemoveMenu(hmenu, IDM_MEDIA, MF_BYCOMMAND);
|
|
||||||
DrawMenuBar(hwndParent);
|
|
||||||
|
|
||||||
free(lpMenuName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* API: Create and set up the Status Bar window. */
|
/* API: Create and set up the Status Bar window. */
|
||||||
void
|
void
|
||||||
StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
|
StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
|
||||||
@@ -1321,9 +839,6 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
|
|||||||
rectDialog.bottom-rectDialog.top,
|
rectDialog.bottom-rectDialog.top,
|
||||||
SWP_SHOWWINDOW);
|
SWP_SHOWWINDOW);
|
||||||
|
|
||||||
/* Load the dummu menu for this window. */
|
|
||||||
menuSBAR = LoadMenu(hInst, SB_MENU_NAME);
|
|
||||||
|
|
||||||
/* Initialize the status bar. This is clumsy. */
|
/* Initialize the status bar. This is clumsy. */
|
||||||
sb_parts = 1;
|
sb_parts = 1;
|
||||||
iStatusWidths = (int *)malloc(sb_parts * sizeof(int));
|
iStatusWidths = (int *)malloc(sb_parts * sizeof(int));
|
||||||
@@ -1332,12 +847,8 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
|
|||||||
memset(sb_part_meanings, 0, sb_parts * sizeof(int));
|
memset(sb_part_meanings, 0, sb_parts * sizeof(int));
|
||||||
sb_part_icons = (uint8_t *)malloc(sb_parts * sizeof(uint8_t));
|
sb_part_icons = (uint8_t *)malloc(sb_parts * sizeof(uint8_t));
|
||||||
memset(sb_part_icons, 0, sb_parts * sizeof(uint8_t));
|
memset(sb_part_icons, 0, sb_parts * sizeof(uint8_t));
|
||||||
sb_menu_handles = (HMENU *)malloc(sb_parts * sizeof(HMENU));
|
|
||||||
memset(sb_menu_handles, 0, sb_parts * sizeof(HMENU));
|
|
||||||
sbTips = (WCHAR **)malloc(sb_parts * sizeof(WCHAR *));
|
sbTips = (WCHAR **)malloc(sb_parts * sizeof(WCHAR *));
|
||||||
memset(sbTips, 0, sb_parts * sizeof(WCHAR *));
|
memset(sbTips, 0, sb_parts * sizeof(WCHAR *));
|
||||||
media_menu_handles = (HMENU *)malloc(sb_parts * sizeof(HMENU));
|
|
||||||
memset(media_menu_handles, 0, sb_parts * sizeof(HMENU));
|
|
||||||
sb_parts = 0;
|
sb_parts = 0;
|
||||||
iStatusWidths[sb_parts] = -1;
|
iStatusWidths[sb_parts] = -1;
|
||||||
sb_part_meanings[sb_parts] = SB_TEXT;
|
sb_part_meanings[sb_parts] = SB_TEXT;
|
||||||
@@ -1347,48 +858,10 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
|
|||||||
SendMessage(hwndSBAR, SB_SETTEXT, 0 | SBT_NOBORDERS,
|
SendMessage(hwndSBAR, SB_SETTEXT, 0 | SBT_NOBORDERS,
|
||||||
(LPARAM)plat_get_string(IDS_2126));
|
(LPARAM)plat_get_string(IDS_2126));
|
||||||
|
|
||||||
//MediaMenuCreate(hwndParent, idStatus, hInst);
|
|
||||||
|
|
||||||
sb_ready = 1;
|
sb_ready = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* API (Settings) */
|
|
||||||
void
|
|
||||||
ui_sb_check_menu_item(int tag, int id, int chk)
|
|
||||||
{
|
|
||||||
uint8_t part;
|
|
||||||
|
|
||||||
if (!sb_ready)
|
|
||||||
return;
|
|
||||||
|
|
||||||
part = sb_map[tag];
|
|
||||||
if ((part == 0xff) || (sb_menu_handles == NULL))
|
|
||||||
return;
|
|
||||||
|
|
||||||
CheckMenuItem(sb_menu_handles[part], id, chk);
|
|
||||||
CheckMenuItem(media_menu_handles[part], id, chk);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* API (Settings) */
|
|
||||||
void
|
|
||||||
ui_sb_enable_menu_item(int tag, int id, int flg)
|
|
||||||
{
|
|
||||||
uint8_t part;
|
|
||||||
|
|
||||||
if (!sb_ready)
|
|
||||||
return;
|
|
||||||
|
|
||||||
part = sb_map[tag];
|
|
||||||
if ((part == 0xff) || (sb_menu_handles == NULL))
|
|
||||||
return;
|
|
||||||
|
|
||||||
EnableMenuItem(sb_menu_handles[part], id, flg);
|
|
||||||
EnableMenuItem(media_menu_handles[part], id, flg);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* API */
|
/* API */
|
||||||
void
|
void
|
||||||
ui_sb_set_text_w(wchar_t *wstr)
|
ui_sb_set_text_w(wchar_t *wstr)
|
||||||
|
Reference in New Issue
Block a user