Skip to content

Commit 748f0c3

Browse files
authored
Halscope improvements (#4553)
* halcope: optimize selection colors The selection colors were to bright, so seen almost as white * halscope: trigger line optimization - change the style of the dotted line - reduce the size of the edge indicator arrow- - swap colors: the trigger arrow now has the color of the channel instead of the trigger line * halscope: change "Gain" to "Scale" This describes the setting better and is consistent with the label named "Scale". Further this is the common way how it is labeled on oscilloscopes. * halscope: show "----" for offset when no channel is selected * halscope: gray out vertical box when no channel is selected * halscope: change label for trigger level of digital signals from "----" to "digital"
1 parent c30de0c commit 748f0c3

3 files changed

Lines changed: 34 additions & 25 deletions

File tree

src/hal/utils/scope_disp.c

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -301,22 +301,22 @@ int normal_colors[16][3] = {
301301
};
302302

303303
int selected_colors[16][3] = {
304-
{255, 204, 204},
305-
{204, 255, 255},
306-
{229, 255, 204},
307-
{229, 204, 255},
308-
{255, 242, 204},
309-
{204, 255, 216},
310-
{204, 216, 255},
311-
{255, 204, 242},
312-
{229, 186, 160},
313-
{220, 229, 160},
314-
{169, 229, 160},
315-
{160, 229, 203},
316-
{160, 203, 229},
317-
{169, 160, 229},
318-
{220, 160, 229},
319-
{229, 160, 186},
304+
{255, 128, 128},
305+
{128, 255, 255},
306+
{179, 255, 128},
307+
{179, 128, 255},
308+
{255, 204, 128},
309+
{128, 255, 153},
310+
{128, 153, 255},
311+
{255, 128, 204},
312+
{204, 153, 128},
313+
{204, 255, 153},
314+
{153, 255, 153},
315+
{153, 255, 204},
316+
{153, 204, 255},
317+
{153, 128, 255},
318+
{204, 128, 255},
319+
{255, 128, 179},
320320
};
321321

322322

@@ -714,7 +714,7 @@ void draw_triggerline(int chan_num, int highlight) {
714714
chan->scale * ((chan->position - trig->level) * 10) +
715715
chan->vert_offset;
716716

717-
const double dashes[2] = {2,4};
717+
const double dashes[2] = {6,6};
718718
int ndash = sizeof(dashes) / sizeof(dashes[0]);
719719

720720
int y1 = (fp_level-yfoffset) * yscale + ypoffset;
@@ -728,23 +728,26 @@ void draw_triggerline(int chan_num, int highlight) {
728728

729729
if(ctrl_shm->trig_edge) dy = -dy;
730730

731+
/* set color for trigger line and edge indicator */
731732
if(highlight) {
732-
gdk_cairo_set_source_rgba(disp->context, &disp->color_selected[chan_num - 1]);
733+
gdk_cairo_set_source_rgba(disp->context, &disp->color_grid);
733734
} else {
734-
gdk_cairo_set_source_rgba(disp->context, &disp->color_normal[chan_num - 1]);
735+
gdk_cairo_set_source_rgba(disp->context, &disp->color_baseline);
735736
}
736737
cairo_set_dash(disp->context, dashes, ndash, 0.0);
737738
line(chan_num | 0x200, 0, y1, disp->width, y1);
738739
/* setting ndash = 0 to disable dashing */
739740
cairo_set_dash(disp->context, dashes, 0, 0.0);
741+
/* set color for trigger edge indicator */
740742
if(highlight) {
741-
gdk_cairo_set_source_rgba(disp->context, &disp->color_grid);
743+
gdk_cairo_set_source_rgba(disp->context, &disp->color_selected[chan_num - 1]);
742744
} else {
743-
gdk_cairo_set_source_rgba(disp->context, &disp->color_baseline);
745+
gdk_cairo_set_source_rgba(disp->context, &disp->color_normal[chan_num - 1]);
744746
}
747+
/* draw trigger edge indicator */
745748
line(chan_num | 0x300, 2*dx, y1, 2*dx, y1 + 2*dy);
746-
line(chan_num | 0x300, dx, y1+dy, 2*dx, y1 + 2*dy);
747-
line(chan_num | 0x300, 3*dx, y1+dy, 2*dx, y1 + 2*dy);
749+
line(chan_num | 0x300, (2-0.7)*dx, y1+1.2*dy, 2*dx, y1 + 2*dy);
750+
line(chan_num | 0x300, (2+0.7)*dx, y1+1.2*dy, 2*dx, y1 + 2*dy);
748751
}
749752

750753

src/hal/utils/scope_trig.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ void refresh_trigger(void)
177177
break;
178178
}
179179
if (chan->data_type == HAL_BOOL) {
180-
snprintf(buf, BUFLEN, " ---- ");
180+
snprintf(buf, BUFLEN, "digital");
181181
gtk_widget_set_sensitive(GTK_WIDGET(trig->level_slider), 0);
182182
} else {
183183
format_signal_value(buf, BUFLEN, fp_level);

src/hal/utils/scope_vert.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ static void init_vert_info_window(void)
593593
0);
594594
/* box for the scale slider */
595595
vbox = gtk_vbox_new_in_box(FALSE, 0, 0, hbox, TRUE, TRUE, 0);
596-
gtk_label_new_in_box(_("Gain"), vbox, FALSE, FALSE, 0);
596+
gtk_label_new_in_box(_("Scale"), vbox, FALSE, FALSE, 0);
597597
vert->scale_adj = gtk_adjustment_new(0, -5, 5, 1, 1, 0);
598598
vert->scale_slider = gtk_scale_new(
599599
GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT(vert->scale_adj));
@@ -628,6 +628,7 @@ static void init_vert_info_window(void)
628628
/* Offset control */
629629
vert->offset_button = gtk_button_new_with_label(_("Offset\n----"));
630630
vert->offset_label = gtk_bin_get_child(GTK_BIN(vert->offset_button));
631+
gtk_label_set_justify(GTK_LABEL(vert->offset_label), GTK_JUSTIFY_CENTER);
631632
gtk_box_pack_start(GTK_BOX(ctrl_usr->vert_info_win),
632633
vert->offset_button, FALSE, FALSE, 0);
633634
g_signal_connect(vert->offset_button, "clicked",
@@ -1067,9 +1068,14 @@ void channel_changed(void)
10671068
gtk_label_set_text_if(vert->scale_label, "----");
10681069
gtk_label_set_text_if(vert->chan_num_label, "--");
10691070
gtk_label_set_text_if(vert->source_name_label, "------");
1071+
gtk_label_set_text_if(vert->offset_label, _("Offset\n----"));
1072+
/* gray out the Vertical info box when no channel is selected */
1073+
gtk_widget_set_sensitive(ctrl_usr->vert_info_win, FALSE);
10701074
request_display_refresh(1);
10711075
return;
10721076
}
1077+
/* enable the Vertical info box when a channel is selected */
1078+
gtk_widget_set_sensitive(ctrl_usr->vert_info_win, TRUE);
10731079
chan = &(ctrl_usr->chan[vert->selected - 1]);
10741080
/* set position slider based on new channel */
10751081
gtk_adjustment_set_value(GTK_ADJUSTMENT(vert->pos_adj),

0 commit comments

Comments
 (0)