Skip to content

Commit

Permalink
Gtk3: CRT controls: better checking for validity of resources
Browse files Browse the repository at this point in the history
Also check `is_pal()` and make `is_pal() return `false` when the chip is Crtc
or VDC, only *create* sliders or delayline checkbox if the resources exist, do
not try to "grey out" widgets that trigger a resource error.
Needs further work to regenerate the CRT status bar controls when switching
machine video standard during runtime.


git-svn-id: https://svn.code.sf.net/p/vice-emu/code/trunk@44107 379a1393-f5fb-40a0-bcee-ef074d9b53f7
  • Loading branch information
Compyx committed Jun 24, 2023
1 parent efd807b commit 860ab27
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions vice/src/arch/gtk3/widgets/crtcontrolwidget.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ static int standard = 0;
*/
static bool is_pal(const char *chip)
{
if (standard == MACHINE_SYNC_PAL || standard == MACHINE_SYNC_PALN) {
if ((standard == MACHINE_SYNC_PAL || standard == MACHINE_SYNC_PALN) &&
(chip[0] != 'C') /* not Crtc */ &&
(!(chip[0] == 'V' && chip[1] == 'D'))) /* not VDC */ {
return true;
}
return false;
Expand Down Expand Up @@ -455,6 +457,9 @@ static int add_sliders(GtkGrid *grid,
if (!(info->emu_mask & machine_class)) {
continue;
}
if (!(is_pal(chip)) && !(info->ntsc)) {
continue;
}

label = create_label(info->label, minimal);

Expand All @@ -481,6 +486,10 @@ static int add_sliders(GtkGrid *grid,
if (!(info->emu_mask & machine_class)) {
continue;
}
if (!(is_pal(chip)) && !(info->ntsc)) {
continue;
}


column = (i % 2) * 2;
label = create_label(info->label, minimal);
Expand All @@ -503,19 +512,6 @@ static int add_sliders(GtkGrid *grid,
}
}

/* Determine if we're using PAL or NTSC: the *PAL* resource sliders should be
* disabled when the video standard is NTSC: */
if (!is_pal(chip)) {
for (i = 0; i < RESOURCE_COUNT; i ++) {
bool ntsc = control_info[i].ntsc;

scale = data->scales[i];
if (scale != NULL) {
gtk_widget_set_sensitive(scale, ntsc);
}
}
}

return row + 1;
}

Expand Down Expand Up @@ -658,7 +654,8 @@ GtkWidget *crt_control_widget_create(GtkWidget *parent,

/* add U-only delayline check button */
if ((machine_class != VICE_MACHINE_CBM6x0) &&
(machine_class != VICE_MACHINE_PET)) {
(machine_class != VICE_MACHINE_PET) &&
(is_pal(chip))) {
data->delayline = create_delayline_widget(chip);
if (minimal) {
vice_gtk3_css_provider_add(data->delayline, checkbutton_css);
Expand All @@ -667,8 +664,6 @@ GtkWidget *crt_control_widget_create(GtkWidget *parent,
gtk_widget_set_margin_top(data->delayline, 8);
gtk_grid_attach(GTK_GRID(grid), data->delayline, 0, row, 3, 1);
}
/* enable if PAL */
gtk_widget_set_sensitive(data->delayline, is_pal(chip));
row++;
}

Expand Down

0 comments on commit 860ab27

Please sign in to comment.