src/mess/tools/imgtool/windows/secview.c
| r8110 | r8111 | |
| 263 | 263 | |
| 264 | 264 | |
| 265 | 265 | |
| 266 | | static void setup_spin_control(HWND dialog, int spin_item, int edit_item) |
| 266 | static void setup_spin_control(HWND dialog, int spin_item, int edit_item, int range_start, int range_end) |
| 267 | 267 | { |
| 268 | 268 | HWND spin_control, edit_control; |
| 269 | 269 | spin_control = GetDlgItem(dialog, spin_item); |
| 270 | 270 | edit_control = GetDlgItem(dialog, edit_item); |
| 271 | 271 | SendMessage(spin_control, UDM_SETBUDDY, (WPARAM) edit_control, 0); |
| 272 | | SendMessage(spin_control, UDM_SETRANGE, 0, MAKELONG(32767, 0)); |
| 272 | SendMessage(spin_control, UDM_SETRANGE, range_start, MAKELONG(range_end, 0)); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | |
| r8110 | r8111 | |
| 285 | 285 | switch(message) |
| 286 | 286 | { |
| 287 | 287 | case WM_INITDIALOG: |
| 288 | { |
| 289 | int tracks = 32768; |
| 290 | int heads = 32768; |
| 291 | int sectors = 32768; |
| 292 | |
| 293 | // TODO: get actual tracks, heads, sectors from image |
| 294 | |
| 288 | 295 | info = (struct sectorview_info *) lparam; |
| 289 | 296 | info->font = create_font(); |
| 290 | 297 | |
| r8110 | r8111 | |
| 298 | 305 | SendMessage(GetDlgItem(dialog, IDC_HEXVIEW), WM_SETFONT, (WPARAM) info->font, (LPARAM) TRUE); |
| 299 | 306 | SetWindowLongPtr(dialog, GWLP_USERDATA, lparam); |
| 300 | 307 | |
| 301 | | setup_spin_control(dialog, IDC_TRACKSPIN, IDC_TRACKEDIT); |
| 302 | | setup_spin_control(dialog, IDC_HEADSPIN, IDC_HEADEDIT); |
| 303 | | setup_spin_control(dialog, IDC_SECTORSPIN, IDC_SECTOREDIT); |
| 308 | setup_spin_control(dialog, IDC_TRACKSPIN, IDC_TRACKEDIT, 0, tracks-1); |
| 309 | setup_spin_control(dialog, IDC_HEADSPIN, IDC_HEADEDIT, 0, heads-1); |
| 310 | setup_spin_control(dialog, IDC_SECTORSPIN, IDC_SECTOREDIT, 0, sectors-1); |
| 304 | 311 | |
| 312 | // TODO: get first sector id instead of try and error |
| 305 | 313 | err = read_sector_data(dialog, 0, 0, 0); |
| 306 | 314 | if (err == IMGTOOLERR_SEEKERROR) |
| 307 | 315 | err = read_sector_data(dialog, 0, 0, 1); |
| 308 | 316 | if (!err) |
| 309 | 317 | set_sector_text(dialog); |
| 310 | 318 | break; |
| 319 | } |
| 311 | 320 | |
| 312 | 321 | case WM_DESTROY: |
| 313 | 322 | info = get_sectorview_info(dialog); |