summaryrefslogtreecommitdiff
path: root/menus.c
diff options
context:
space:
mode:
authorMichael J. Chudobiak <mjc@avtechpulse.com>2012-08-31 09:11:52 -0400
committerMichael J. Chudobiak <mjc@avtechpulse.com>2012-08-31 09:11:52 -0400
commitd0aa500d7e6a0e3d0e3967aa0edda9f89c05eb55 (patch)
treea7fe379565a053f084282b7256a553f4ae9fd5bc /menus.c
parent060b13f50acd4b5eda8179e66a8e09a1b4c69d05 (diff)
use g_str functions for submenu title
Diffstat (limited to 'menus.c')
-rw-r--r--menus.c95
1 files changed, 47 insertions, 48 deletions
diff --git a/menus.c b/menus.c
index e303327..2d26ca2 100644
--- a/menus.c
+++ b/menus.c
@@ -1079,7 +1079,6 @@ static void Display_Number_on_LCD(int Is_Item_Visible,int LCD_row,int LCD_col,ch
{
gchar *units = NULL;
int show_plus_sign;
- int i;
int channel;
char LCD_string[LCD_cols+1];
@@ -1237,7 +1236,7 @@ static void Display_Number_on_LCD(int Is_Item_Visible,int LCD_row,int LCD_col,ch
static void Submenu_Display(int redraw)
{
- char title[LCD_chars_total+1];
+ gchar *title = NULL;
char mode_name[Submenu_maximum_entries][LCD_col_width+1];
int i;
int j;
@@ -1265,10 +1264,10 @@ static void Submenu_Display(int redraw)
case Submenu1_freq:
if (globals.ChannelState[channel].trigger_source==source_internal) {
- strcpy(title,"Internal Clock:");
+ title = g_strdup ("Internal Clock:");
Submenu_Numeric_Parameter=Show_frequency+channel;
} else {
- strcpy(title,"Trigger Menu");
+ title = g_strdup ("Trigger Menu");
}
if (globals.Flash.is_func_gen[channel]) {
@@ -1285,7 +1284,7 @@ static void Submenu_Display(int redraw)
case Submenu1_func:
- strcpy(title,"Shape Menu");
+ title = g_strdup ("Shape Menu");
Submenu_max_entry=4;
Submenu_Structure[0]=mode_func_sin;
Submenu_Structure[1]=mode_func_tri;
@@ -1298,9 +1297,9 @@ static void Submenu_Display(int redraw)
case Submenu1_delay:
if (globals.ChannelState[channel].double_pulse==double_off) {
- strcpy(title,"Delay:");
+ title = g_strdup ("Delay:");
} else {
- strcpy(title,"Pulse Spacing:");
+ title = g_strdup ("Pulse Spacing:");
}
Submenu_Numeric_Parameter=Show_delay+channel;
@@ -1318,14 +1317,14 @@ static void Submenu_Display(int redraw)
case Submenu1_pw:
if (globals.ChannelState[channel].ab_mode==pw_normal) {
if (globals.ChannelState[channel].hold_setting==hold_width) {
- strcpy(title,"Pulse Width:");
+ title = g_strdup ("Pulse Width:");
Submenu_Numeric_Parameter=Show_pw+channel;
} else {
- strcpy(title,"Duty Cycle:");
+ title = g_strdup ("Duty Cycle:");
Submenu_Numeric_Parameter=Show_duty_cycle+channel;
}
} else {
- strcpy(title,"Pulse Width:");
+ title = g_strdup ("Pulse Width:");
}
Submenu_max_entry=0;
@@ -1345,16 +1344,14 @@ static void Submenu_Display(int redraw)
break;
case Submenu1_amp:
- strcpy(title,"Amplitude");
-
if (globals.Flash.enable_avrq_extra_ampls) {
if (channel==0) {
- strcat(title,"1 (HV):");
+ title = g_strdup ("Amplitude1 (HV):");
} else {
- strcat(title,"2 (IBIAS):");
+ title = g_strdup ("Amplitude2 (IBIAS):");
}
} else {
- strcat(title,":");
+ title = g_strdup ("Amplitude:");
}
@@ -1384,13 +1381,13 @@ static void Submenu_Display(int redraw)
switch (channel) {
case 2:
- strcpy(title,"Amplitude3 (Vcc1):");
+ title = g_strdup ("Amplitude3 (Vcc1):");
break;
case 3:
- strcpy(title,"Amplitude4 (Vcc2):");
+ title = g_strdup ("Amplitude4 (Vcc2):");
break;
case 4:
- strcpy(title,"Amplitude5 (Vlogic):");
+ title = g_strdup ("Amplitude5 (Vlogic):");
break;
}
@@ -1398,50 +1395,50 @@ static void Submenu_Display(int redraw)
break;
case Submenu1_burst_count:
- strcpy(title,"Pulses per burst:");
+ title = g_strdup ("Pulses per burst:");
Submenu_Numeric_Parameter=Show_Burst_Count+channel;
Submenu_max_entry=0;
break;
case Submenu1_burst_time:
- strcpy(title,"Burst Spacing (i.e., low interval):");
+ title = g_strdup ("Burst Spacing (i.e., low interval):");
Submenu_Numeric_Parameter=Show_Burst_Time+channel;
Submenu_max_entry=0;
break;
case Submenu1_rise_time:
- strcpy(title,"Rise time (10%-90%):");
+ title = g_strdup ("Rise time (10%-90%):");
Submenu_Numeric_Parameter=Show_rise_time+channel;
Submenu_max_entry=0;
break;
case Submenu1_slew:
- strcpy(title,"Slew rate:");
+ title = g_strdup ("Slew rate:");
Submenu_Numeric_Parameter=Show_slew+channel;
Submenu_max_entry=0;
break;
case Submenu1_soft_current_limit:
- strcpy(title,"Current limit:");
+ title = g_strdup ("Current limit:");
Submenu_Numeric_Parameter=Show_soft_current_limit+channel;
Submenu_max_entry=0;
break;
case Submenu1_zout:
- strcpy(title,"Output Impedance");
+ title = g_strdup ("Output Impedance");
Submenu_max_entry=1;
Submenu_Structure[0]=mode_zout_min;
Submenu_Structure[1]=mode_zout_max;
break;
case Submenu1_loadtype:
- strcpy(title,"Load Impedance");
+ title = g_strdup ("Load Impedance");
Submenu_Numeric_Parameter=Show_load_type+channel;
Submenu_max_entry=0;
break;
case Submenu1_offset:
- strcpy(title,"Offset:");
+ title = g_strdup ("Offset:");
if (globals.ChannelState[channel].os_mode==os_mode_normal) {
Submenu_Numeric_Parameter=Show_offset+channel;
@@ -1459,7 +1456,7 @@ static void Submenu_Display(int redraw)
case Submenu1_mon:
Submenu_max_entry=0;
- strcpy(title,"Monitor:");
+ title = g_strdup ("Monitor:");
if (globals.ChannelState[channel].pw<globals.Flash.mon_pw_threshold[channel]) {
LCD_write(2,2,"*PW too narrow for accurate reading.");
}
@@ -1467,7 +1464,7 @@ static void Submenu_Display(int redraw)
break;
case Submenu1_output_state:
- strcpy(title,"Output State:");
+ title = g_strdup ("Output State:");
Submenu_max_entry=1;
Submenu_Structure[0]=mode_output_on;
@@ -1476,7 +1473,7 @@ static void Submenu_Display(int redraw)
break;
case Submenu1_invert:
- strcpy(title,"Inverted Output?:");
+ title = g_strdup ("Inverted Output?:");
Submenu_max_entry=1;
Submenu_Structure[0]=mode_inv_no;
@@ -1485,14 +1482,14 @@ static void Submenu_Display(int redraw)
break;
case Submenu1_logic_level:
- strcpy(title,"Logic Outputs:");
+ title = g_strdup ("Logic Outputs:");
Submenu_max_entry=1;
Submenu_Structure[0]=mode_logic_ttl;
Submenu_Structure[1]=mode_logic_ecl;
break;
case Submenu1_gate:
- strcpy(title,"Gate (trigger off) ");
+ title = g_strdup ("Gate (trigger off) ");
Submenu_max_entry=1;
Submenu_Structure[0]=mode_gate_losync;
@@ -1508,7 +1505,7 @@ static void Submenu_Display(int redraw)
break;
case Submenu1_rem_loc:
- strcpy(title,"Control Mode:");
+ title = g_strdup ("Control Mode:");
Submenu_max_entry=1;
Submenu_Structure[0]=mode_go_to_local;
@@ -1516,7 +1513,7 @@ static void Submenu_Display(int redraw)
break;
case Submenu1_setup:
- strcpy(title,"Setup Menu:");
+ title = g_strdup ("Setup Menu:");
Submenu_max_entry=5;
if (globals.Flash.self_cal) {
@@ -1533,7 +1530,7 @@ static void Submenu_Display(int redraw)
break;
case Submenu2_save:
- strcpy(title,"Save Settings:");
+ title = g_strdup ("Save Settings:");
Submenu_max_entry=3;
Submenu_Structure[0]=mode_save_0;
@@ -1543,7 +1540,7 @@ static void Submenu_Display(int redraw)
break;
case Submenu2_load:
- strcpy(title,"Load Settings:");
+ title = g_strdup ("Load Settings:");
Submenu_max_entry=3;
Submenu_Structure[0]=mode_load_0;
@@ -1553,7 +1550,7 @@ static void Submenu_Display(int redraw)
break;
case Submenu1_memory:
- strcpy(title,"Memory:");
+ title = g_strdup ("Memory:");
Submenu_max_entry=2;
Submenu_Structure[0]=mode_load;
@@ -1562,7 +1559,7 @@ static void Submenu_Display(int redraw)
break;
case Submenu2_rs232:
- strcpy(title,"Serial Port:");
+ title = g_strdup ("Serial Port:");
Submenu_max_entry=2;
Submenu_Structure[0]=mode_change_rs232;
@@ -1571,7 +1568,7 @@ static void Submenu_Display(int redraw)
break;
case Submenu2_rs232_baud:
- strcpy(title,"Baud Rate:");
+ title = g_strdup ("Baud Rate:");
Submenu_max_entry=3;
Submenu_Structure[0]=mode_1200;
@@ -1581,7 +1578,7 @@ static void Submenu_Display(int redraw)
break;
case Submenu2_rs232_databits:
- strcpy(title,"Data Bits:");
+ title = g_strdup ("Data Bits:");
Submenu_max_entry=1;
Submenu_Structure[0]=mode_7bits;
@@ -1589,7 +1586,7 @@ static void Submenu_Display(int redraw)
break;
case Submenu2_rs232_parity:
- strcpy(title,"Parity:");
+ title = g_strdup ("Parity:");
Submenu_max_entry=2;
Submenu_Structure[0]=mode_par_none;
@@ -1598,7 +1595,7 @@ static void Submenu_Display(int redraw)
break;
case Submenu2_rs232_stopbits:
- strcpy(title,"Stop Bits:");
+ title = g_strdup ("Stop Bits:");
Submenu_max_entry=1;
Submenu_Structure[0]=mode_1bit;
@@ -1606,7 +1603,7 @@ static void Submenu_Display(int redraw)
break;
case Submenu2_rs232_hardhand:
- strcpy(title,"Handshaking:");
+ title = g_strdup ("Handshaking:");
Submenu_max_entry=1;
Submenu_Structure[0]=mode_hand_hard;
@@ -1614,7 +1611,7 @@ static void Submenu_Display(int redraw)
break;
case Submenu2_rs232_echo:
- strcpy(title,"Echo:");
+ title = g_strdup ("Echo:");
Submenu_max_entry=1;
Submenu_Structure[0]=mode_echo_on;
@@ -1622,29 +1619,29 @@ static void Submenu_Display(int redraw)
break;
case Submenu2_gpib_address:
- strcpy(title,"GPIB Address:");
+ title = g_strdup ("GPIB Address:");
Submenu_Numeric_Parameter=Show_gpib_address+channel;
break;
case Submenu1_route_primary:
if (globals.Flash.routing_required[channel] == 1) {
- strcpy(title,"Output route:");
+ title = g_strdup ("Output route:");
} else {
- strcpy(title,"Anode pin:");
+ title = g_strdup ("Anode pin:");
}
Submenu_Numeric_Parameter=Show_route_primary+channel;
Submenu_max_entry=0;
break;
case Submenu1_route_secondary:
- strcpy(title,"Cathode pin:");
+ title = g_strdup ("Cathode pin:");
Submenu_Numeric_Parameter=Show_route_secondary+channel;
Submenu_max_entry=0;
break;
default:
- strcpy(title,"error - not implemented");
+ title = g_strdup ("error - not implemented");
}
for (i=0; i<=Submenu_max_entry; ++i) {
@@ -1652,6 +1649,8 @@ static void Submenu_Display(int redraw)
}
LCD_write(0,0,title);
+ g_free (title);
+
Display_Number_on_LCD(YES,1,2,"",Submenu_Numeric_Parameter,4,LCD_col_width);
LCD_write(3,0,Press_Change_Message);