static void selection_changed_cb (GtkTreeSelection *selection, BookmarkEditor *editor) { GtkTreeModel *model; GtkTreeIter iter; GNode *node; gftp2_bookmark *bm; model = GTK_TREE_MODEL (editor->store); /* save possible change */ if (editor->selected_node != NULL && editor->selected_node_content_changed) { save_node_change (); editor->selected_node_content_changed = 0; } block_entry_change_signal (); if (gtk_tree_selection_get_selected (selection, NULL, &iter) == FALSE) { editor->selected_node = NULL; set_blank (); set_sensitivity (); unblock_entry_change_signal (); return; } else { char buf[10]; gtk_tree_model_get (model, &iter, COLUMN_ENTRY, &node, -1); bm = (gftp2_bookmark *)node->data; editor->selected_node = node; if (bm->is_folder) { set_blank (); gtk_entry_set_text (editor->name_entry, bm->name); set_sensitivity (); unblock_entry_change_signal (); return; } set_sensitivity (); gtk_entry_set_text (editor->name_entry, bm->name); gtk_entry_set_text (GTK_ENTRY (editor->host_entry), bm->hostname == NULL ? "": bm->hostname); gtk_entry_set_text (GTK_ENTRY (editor->user_entry), (bm->user == NULL) ? "": bm->user); gtk_entry_set_text (GTK_ENTRY (editor->passwd_entry), (bm->passwd == NULL) ? "": bm->passwd); snprintf (buf, 10, "%d", bm->port); gtk_entry_set_text (GTK_ENTRY (editor->port_entry), buf); if (bm->protocol != NULL) gtk_combo_box_set_active (GTK_COMBO_BOX (editor->protocol_combo), gftp2_protocol_text_to_index (bm->protocol)); } unblock_entry_change_signal (); }
static int setvar(const char *varname, const char *val) { if (!strcasecmp(varname, "ups.id")) { set_identification(val); get_identification(); return STAT_SET_HANDLED; } if (!strcasecmp(varname, "input.transfer.low")) { set_transfer_voltage_low(atoi(val)); get_transfer_voltage_low(); return STAT_SET_HANDLED; } if (!strcasecmp(varname, "input.transfer.high")) { set_transfer_voltage_high(atoi(val)); get_transfer_voltage_high(); return STAT_SET_HANDLED; } if (!strcasecmp(varname, "input.sensitivity")) { set_sensitivity(val); get_sensitivity(); return STAT_SET_HANDLED; } upslogx(LOG_NOTICE, "setvar: unknown var [%s]", varname); return STAT_SET_UNKNOWN; }
void msgt_cb(Widget w, XtPointer client_data, XtPointer call_data) { int *msg_type = (int *)client_data; temp_msg_type = *msg_type; set_sensitivity(); }
bool airspyHandler::restartReader (void) { int result; int32_t bufSize = EXTIO_NS * EXTIO_BASE_TYPE_SIZE * 2; if (running) return true; theBuffer -> FlushRingBuffer (); if (currentTab == 0) set_sensitivity (sensitivitySlider -> value ()); else if (currentTab == 1) set_linearity (linearitySlider -> value ()); else { set_vga_gain (vgaGain); set_mixer_gain (mixerGain); set_lna_gain (lnaGain); } result = my_airspy_set_sample_type (device, AIRSPY_SAMPLE_FLOAT32_IQ); if (result != AIRSPY_SUCCESS) { printf ("my_airspy_set_sample_type () failed: %s (%d)\n", my_airspy_error_name ((airspy_error)result), result); return false; } setExternalRate (inputRate); set_linearity (linearitySlider -> value ()); set_sensitivity (sensitivitySlider -> value ()); result = my_airspy_start_rx (device, (airspy_sample_block_cb_fn)callback, this); if (result != AIRSPY_SUCCESS) { printf ("my_airspy_start_rx () failed: %s (%d)\n", my_airspy_error_name((airspy_error)result), result); return false; } // // finally: buffer = new uint8_t [bufSize]; bs_ = bufSize; bl_ = 0; running = true; return true; }
void digf_cb(Widget w, XtPointer client_data, XtPointer call_data) { int *dig_flag = (int *)client_data; temp_digflag = *dig_flag; set_sensitivity(); }
void airspyHandler::show_tab (int t) { if (t == 0) // sensitivity set_sensitivity (sensitivitySlider -> value ()); else if (t == 1) // linearity set_linearity (linearitySlider -> value ()); else { // classic view set_vga_gain (vgaGain); set_mixer_gain (mixerGain); set_lna_gain (lnaGain); } currentTab = t; }
// reset the spaceball to original settings void Spaceball::reset(void) { // set the default motion mode and initialize button state move_mode(NORMAL); // set global spaceball sensitivity within VMD // (this has no effect on underlying driver sensitivity settings) set_sensitivity(1.0f); // set the null region to a small value initially set_null_region(16); // set the maximum animate stride allowed to 20 by default set_max_stride(20); // set the default translation and rotation increments // these really need to be made user modifiable at runtime transInc = 1.0f / 25000.0f; rotInc = 1.0f / 200.0f; scaleInc = 1.0f / 25000.0f; animInc = 1.0f / 75.0f; }
bool init_accel(void) { // Set Internal Clock to PLL with X gyroscope, recommended // Disables Temperature Sensor uint8_t c = (1 << 3) | (1 << 0); if (i2c_writeReg(ACCEL_ADDR, PWR_MGMT_1, &c, 1) != 0) { return false; } set_sensitivity(1); // Set Motion Trigger Duration to 2ms c = 2; if (i2c_writeReg(ACCEL_ADDR, MOT_DUR, &c, 1) != 0) { return false; } // Clear Interrupts accel_clear_int(); // Enable Motion Trigger Interrupts c = 0x40; if (i2c_writeReg(ACCEL_ADDR, INT_ENABLE, &c, 1) != 0) { return false; } return true; }
void show_bookmark_editor (GtkMenuItem *item, gpointer data) { GError *err = NULL; if (editor == NULL) { editor = g_malloc0 (sizeof(BookmarkEditor)); gtk_builder_get_all_widgets_simple (BOOKMARK_EDITOR_UI, "BMWindow", &editor->window, "treeview", &editor->treeview, "toolbar", &editor->toolbar, "add_button", &editor->add_button, "delete_button", &editor->delete_button, "name_entry", &editor->name_entry, "host_entry", &editor->host_entry, "protocol_combo", &editor->protocol_combo, "user_entry", &editor->user_entry, "passwd_entry", &editor->passwd_entry, "port_entry", &editor->port_entry, "save_button", &editor->save_button, "connect_button", &editor->connect_button, NULL); g_signal_connect (editor->window, "delete-event", G_CALLBACK(delete_event_cb), NULL); gtk_window_set_transient_for (editor->window, GTK_WINDOW(gftp_interface->window)); setup_treeview(); setup_toolbar(); setup_protocol_combo(); setup_edit_area (); set_sensitivity (); } gtk_widget_show_all (GTK_WIDGET (editor->window)); }
static void show_week (UmHistoryDialog *um) { GArray *login_history; GDateTime *datetime, *temp; gint64 from, to; gint i, line; GtkWidget *grid; UmLoginHistory history; show_week_label (um); clear_history (um); set_sensitivity (um); login_history = get_login_history (um->user); if (login_history == NULL) { return; } /* Find first record for week */ from = g_date_time_to_unix (um->week); temp = g_date_time_add_weeks (um->week, 1); to = g_date_time_to_unix (temp); g_date_time_unref (temp); for (i = login_history->len - 1; i >= 0; i--) { history = g_array_index (login_history, UmLoginHistory, i); if (history.login_time < to) { break; } } /* Add new session records */ grid = get_widget (um, "history-grid"); line = 0; for (;i >= 0; i--) { history = g_array_index (login_history, UmLoginHistory, i); if (history.logout_time > 0 && history.logout_time < from) { break; } /* Display only x-sessions */ if (g_strrstr (history.type, ":") == NULL) { continue; } if (history.logout_time > 0 && history.logout_time < to) { datetime = g_date_time_new_from_unix_local (history.logout_time); add_record (grid, datetime, "Session Ended", line); line++; } if (history.login_time >= from) { datetime = g_date_time_new_from_unix_local (history.login_time); add_record (grid, datetime, "Session Started", line); line++; } } gtk_widget_show_all (grid); g_array_free (login_history, TRUE); }
/* fills the fields by reading entries in the global arrays */ void product_edit_fill_fields() { XmString xmstr, preview_xtr; char *str, *datastr, buf[200], preview_str[40]; int pid, *dataptr, data; /* first, find the product ID of the current product */ XtVaGetValues(id_label, XmNlabelString, &xmstr, NULL); XmStringGetLtoR(xmstr, XmFONTLIST_DEFAULT_TAG, &str); pid = atoi(str); free(str); XmStringFree(xmstr); /* DEBUG */ /* fprintf(stderr,"DEBUG - entering product_edit_fill_fields \n"); */ if( !((pid >=0) && (pid <= 1999)) ) fprintf(stderr,"ERROR in Product ID (%d) This value is outside of the\n" " range of values produced by the radar (1-1999).\n", pid); /* now, fill the rest of the fields */ /****************************************************************/ dataptr = assoc_access_i(msg_type_list, pid); if(dataptr != NULL) data = *dataptr; else data = -1; if(data==0) { msgt_but_set = msgt_but0; temp_msg_type = 0; } else if(data==1) { msgt_but_set = msgt_but1; temp_msg_type = 1; } else if(data==2) { msgt_but_set = msgt_but2; temp_msg_type = 2; } else if(data==3) { msgt_but_set = msgt_but3; temp_msg_type = 3; } else if(data==4) { msgt_but_set = msgt_but4; temp_msg_type = 4; } else if(data==999) { msgt_but_set = msgt_but999; temp_msg_type = 999; } else if(data==-1) { msgt_but_set = msgt_but1neg; temp_msg_type = -1; } else { fprintf(stderr,"ERROR message type (%d) for ID %d is not\n" " valid, reset to default value '-1'.\n", data, pid); msgt_but_set = msgt_but1neg; temp_msg_type = -1; } XtVaSetValues(msgtype_opt, XmNmenuHistory, msgt_but_set, NULL); /* CVG 9.1 - added packet 1 coord override for geographic products */ /****************************************************************/ /* DEBUG */ /*fprintf(stderr,"DEBUG product_edit_fill_fields - reading pkt1 flag / " */ /* "setting temp_pkt1_flag, pid is %d\n", pid); */ dataptr = assoc_access_i(packet_1_geo_coord_flag, pid); if(dataptr != NULL) data = *dataptr; else data = 0; if(data==0) { pkt1_but_set = pkt1_but0; temp_pkt1_flag = 0; } else if(data==1) { pkt1_but_set = pkt1_but1; temp_pkt1_flag = 1; } else { fprintf(stderr,"ERROR packet 1 override (%d) for ID %d is not\n" " valid, reset to default value '0'.\n", data, pid); pkt1_but_set = pkt1_but0; temp_pkt1_flag = 0; } XtVaSetValues(packet_1_opt, XmNmenuHistory, pkt1_but_set, NULL); /* DEBUG */ /*fprintf(stderr,"DEBUG product_edit_fill_fields - reading product res / " */ /* "setting resi_but_set\n"); */ /****************************************************************/ dataptr = assoc_access_i(product_res, pid); if(dataptr != NULL) data = *dataptr; else data = -1; if(data==0) { resi_but_set = resi_but0; temp_resindex = 0; } else if(data==1) { resi_but_set = resi_but1; temp_resindex = 1; } else if(data==2) { resi_but_set = resi_but2; temp_resindex = 2; } else if(data==3) { resi_but_set = resi_but3; temp_resindex = 3; } else if(data==4) { resi_but_set = resi_but4; temp_resindex = 4; } else if(data==5) { resi_but_set = resi_but5; temp_resindex = 5; } else if(data==6) { resi_but_set = resi_but6; temp_resindex = 6; } else if(data==7) { resi_but_set = resi_but7; temp_resindex = 7; } else if(data==8) { resi_but_set = resi_but8; temp_resindex = 8; } else if(data==9) { resi_but_set = resi_but9; temp_resindex = 9; } else if(data==10) { resi_but_set = resi_but10; temp_resindex = 10; } else if(data==11) { resi_but_set = resi_but11; temp_resindex = 11; } else if(data==12) { resi_but_set = resi_but12; temp_resindex = 12; } else if(data==13) { resi_but_set = resi_but13; temp_resindex = 13; } else if(data==-1) { resi_but_set = resi_but1neg; temp_resindex = -1; } else { fprintf(stderr,"ERROR product resolution (%d) for ID %d is not\n" " valid, reset to default value '-1'.\n", data, pid); resi_but_set = resi_but1neg; temp_resindex = -1; } XtVaSetValues(resindex_opt, XmNmenuHistory, resi_but_set, NULL); /**************************************************************************/ /* CVG 9.1 - added override of colors for non-2d array packets */ datastr = assoc_access_s(override_palette, pid); if(datastr != NULL) strcpy(buf, datastr); else strcpy(buf, ".plt"); if(check_filename("plt", buf)==FALSE) { fprintf(stderr,"ERROR palette filename (%s) for ID %d is not\n" " valid, reset to default value '.plt'\n", buf, pid); strcpy(buf, ".plt"); } XtVaSetValues(override_palette_text, XmNvalue, buf, NULL); /***************************************************************************/ /* CVG 9.1 - added override of colors for non-2d array packets */ dataptr = assoc_access_i(override_packet, pid); if(dataptr != NULL) data = *dataptr; else data = 0; if(data==0) { over_but_set = over_but0; temp_overridepacket = 0; } else if(data==4) { over_but_set = over_but4; temp_overridepacket = 4; } else if(data==6) { over_but_set = over_but6; temp_overridepacket = 6; } else if(data==8) { over_but_set = over_but8; temp_overridepacket = 8; } else if(data==9) { over_but_set = over_but9; temp_overridepacket = 9; } else if(data==10) { over_but_set = over_but10; temp_overridepacket = 10; } else if(data==20) { /* SHOULD THIS BE INCLUDED? */ over_but_set = over_but20; temp_overridepacket = 20; } else if(data==43) { over_but_set = over_but43; temp_overridepacket = 43; } else if(data==51) { /* contour IT'S BACK */ over_but_set = over_but51; temp_overridepacket = 51; } else { fprintf(stderr,"ERROR associated packet (%d) for ID %d is not\n" " valid/supported, reset to default value '0'.\n", data, pid); over_but_set = over_but0; temp_overridepacket = 0; } XtVaSetValues(overridepacket_opt, XmNmenuHistory, over_but_set, NULL); /* DEBUG */ /*fprintf(stderr,"DEBUG product_edit_fill_fields - setting override_palette_text ,%s, "*/ /* "and temp_overridepacket %d \n", */ /* buf, temp_overridepacket); */ /****************************************************************/ dataptr = assoc_access_i(digital_legend_flag, pid); if(dataptr != NULL) data = *dataptr; else data = -1; if(data==0) { digf_but_set = digf_but0; temp_digflag = 0; } else if(data==1) { digf_but_set = digf_but1; temp_digflag = 1; } else if(data==2) { digf_but_set = digf_but2; temp_digflag = 2; } else if(data==3) { digf_but_set = digf_but3; temp_digflag = 3; } else if(data==4) { digf_but_set = digf_but4; temp_digflag = 4; } else if(data==5) { digf_but_set = digf_but5; temp_digflag = 5; } else if(data==6) { digf_but_set = digf_but6; temp_digflag = 6; } else if(data==-1) { digf_but_set = digf_but1neg; temp_digflag = -1; } else { fprintf(stderr,"ERROR legend flag (%d) for ID %d is not\n" " valid, reset to default value '-1'.\n", data, pid); digf_but_set = digf_but1neg; temp_digflag = -1; } /* DEBUG */ /* fprintf(stderr,"DEBUG product_edit_fill_fields - setting dig flag button\n"); */ XtVaSetValues(digflag_opt, XmNmenuHistory, digf_but_set, NULL); /****************************************************************/ datastr = assoc_access_s(digital_legend_file, pid); if(datastr != NULL) strcpy(buf, datastr); else strcpy(buf, ".lgd"); if(check_filename("lgd", buf)==FALSE) { fprintf(stderr,"ERROR legend filename (%s) for ID %d is not\n" " valid, reset to default value '.lgd'\n", buf, pid); strcpy(buf, ".lgd"); } XtVaSetValues(diglegfile_text, XmNvalue, buf, NULL); /****************************************************************/ datastr = assoc_access_s(dig_legend_file_2, pid); if(datastr != NULL) strcpy(buf, datastr); else strcpy(buf, ".lgd"); if(check_filename("lgd", buf)==FALSE) { fprintf(stderr,"ERROR legend filename (%s) for ID %d is not\n" " valid, reset to default value '.lgd'\n", buf, pid); strcpy(buf, ".lgd"); } XtVaSetValues(diglegfile2_text, XmNvalue, buf, NULL); /****************************************************************/ datastr = assoc_access_s(configured_palette, pid); if(datastr != NULL) strcpy(buf, datastr); else strcpy(buf, ".plt"); if(check_filename("plt", buf)==FALSE) { fprintf(stderr,"ERROR palette filename (%s) for ID %d is not\n" " valid, reset to default value '.plt'\n", buf, pid); strcpy(buf, ".plt"); } XtVaSetValues(confpalette_text, XmNvalue, buf, NULL); /****************************************************************/ datastr = assoc_access_s(config_palette_2, pid); if(datastr != NULL) strcpy(buf, datastr); else strcpy(buf, ".plt"); if(check_filename("plt", buf)==FALSE) { fprintf(stderr,"ERROR palette filename (%s) for ID %d is not\n" " valid, reset to default value '.plt'\n", buf, pid); strcpy(buf, ".plt"); } XtVaSetValues(confpalette2_text, XmNvalue, buf, NULL); /****************************************************************/ dataptr = assoc_access_i(associated_packet, pid); if(dataptr != NULL) data = *dataptr; else data = 0; if(data==0) { assp_but_set = assp_but0; temp_assocpacket = 0; } else if(data==4) { assp_but_set = assp_but4; temp_assocpacket = 4; } else if(data==6) { assp_but_set = assp_but6; temp_assocpacket = 6; } else if(data==8) { assp_but_set = assp_but8; temp_assocpacket = 8; } else if(data==9) { assp_but_set = assp_but9; temp_assocpacket = 9; } else if(data==10) { assp_but_set = assp_but10; temp_assocpacket = 10; } else if(data==16) { assp_but_set = assp_but16; temp_assocpacket = 16; } else if(data==17) { assp_but_set = assp_but17; temp_assocpacket = 17; /* cvg 9.0 - removed */ /* } else if(data==18) { */ /* assp_but_set = assp_but18;*/ /* temp_assocpacket = 18; */ } else if(data==20) { assp_but_set = assp_but20; temp_assocpacket = 20; } else if(data==41) { assp_but_set = assp_but41; temp_assocpacket = 41; } else if(data==42) { assp_but_set = assp_but42; temp_assocpacket = 42; } else if(data==43) { assp_but_set = assp_but43; temp_assocpacket = 43; } else if(data==51) { /* contour IIIIIIIIT'S BAAAAAAAAAACK */ assp_but_set = assp_but51; temp_assocpacket = 51; } else if(data==53) { assp_but_set = assp_but53; temp_assocpacket = 53; } else if(data==54) { assp_but_set = assp_but54; temp_assocpacket = 54; } else if(data==55) { assp_but_set = assp_but55; temp_assocpacket = 55; } else { fprintf(stderr,"ERROR associated packet (%d) for ID %d is not\n" " valid/supported, reset to default value '0'.\n", data, pid); assp_but_set = assp_but0; temp_assocpacket = 0; } XtVaSetValues(assocpacket_opt, XmNmenuHistory, assp_but_set, NULL); /****************************************************************/ datastr = assoc_access_s(legend_units, pid); if(datastr != NULL) strcpy(buf, datastr); else strcpy(buf, ""); XtVaSetValues(unit_text, XmNvalue, buf, NULL); set_sensitivity(); pref_legend_grey_pixmap(); pref_legend_show_pixmap(); /* CVG 9.1 */ /* update the sample legend display if assocpaket is a 2-d array */ if(temp_assocpacket == 16 || temp_assocpacket == 17 || temp_assocpacket == 41 || temp_assocpacket == 42 || temp_assocpacket == 53 || temp_assocpacket == 54 || temp_assocpacket == 55) { if(temp_digflag != 0) pref_legend_clear_pixmap(); display_legend_blocks(pref_legend_pix, 5, 5, TRUE, PREFS_FRAME); pref_legend_show_pixmap(); if( (temp_digflag == 1) || (temp_digflag == 2) || (temp_digflag == 3) ) sprintf(preview_str, "Digital Legend \nPreview"); else if( (temp_digflag==4) || (temp_digflag==5) || (temp_digflag==6) ) sprintf(preview_str, "Generic Legend \nPreview"); else /* not digital / generic product */ sprintf(preview_str, "Color Palette \nPreview"); } else { /* end if assoc packet is a 2-d array */ sprintf(preview_str, " \n "); } preview_xtr = XmStringCreateLtoR(preview_str, XmFONTLIST_DEFAULT_TAG); XtVaSetValues(ledg_label, XmNlabelString, preview_xtr, NULL); XmStringFree(preview_xtr); /* CVG 9.3 - added elevation flag */ /****************************************************************/ dataptr = assoc_access_i(elev_flag, pid); if(dataptr != NULL) data = *dataptr; else data = -1; if(data==0) { elf_but_set = elf_but0; temp_elflag = 0; } else if(data==1) { elf_but_set = elf_but1; temp_elflag = 1; } else { fprintf(stderr,"ERROR elevation flag (%d) for ID %d is not\n" " valid, reset to default value '0'.\n", data, pid); elf_but_set = elf_but0; temp_elflag = 0; } /* DEBUG */ /* fprintf(stderr,"DEBUG product_edit_fill_fields - setting elevation flag\n"); */ XtVaSetValues(elflag_opt, XmNmenuHistory, elf_but_set, NULL); /* DEBUG */ /* fprintf(stderr,"DEBUG - leaving product_edit_fill_fields \n"); */ } /* end product_edit_fill_fields() */