static int recv_backup (CalcHandle* handle, BackupContent* content) { char varname[9] = { 0 }; g_snprintf(update_->text, sizeof(update_->text), _("Waiting for backup...")); update_label(); content->model = CALC_TI86; strcpy(content->comment, tifiles_comment_set_backup()); TRYF(ti85_recv_VAR(&(content->data_length1), &content->type, varname)); content->data_length2 = (uint8_t)varname[0] | ((uint8_t)varname[1] << 8); content->data_length3 = (uint8_t)varname[2] | ((uint8_t)varname[3] << 8); content->data_length4 = (uint8_t)varname[4] | ((uint8_t)varname[5] << 8); TRYF(ti85_send_ACK()); TRYF(ti85_send_CTS()); TRYF(ti85_recv_ACK(NULL)); strcpy(update_->text, ""); update_label(); update_->cnt2 = 0; update_->max2 = 4; update_->pbar(); content->data_part1 = tifiles_ve_alloc_data(65536); TRYF(ti85_recv_XDP(&content->data_length1, content->data_part1)); TRYF(ti85_send_ACK()); update_->cnt2++; update_->pbar(); content->data_part2 = tifiles_ve_alloc_data(65536); TRYF(ti85_recv_XDP(&content->data_length2, content->data_part2)); TRYF(ti85_send_ACK()); update_->cnt2++; update_->pbar(); if (content->data_length3) { content->data_part3 = tifiles_ve_alloc_data(65536); TRYF(ti85_recv_XDP(&content->data_length3, content->data_part3)); TRYF(ti85_send_ACK()); } else content->data_part3 = NULL; update_->cnt2++; update_->pbar(); content->data_part4 = tifiles_ve_alloc_data(65536); TRYF(ti85_recv_XDP(&content->data_length4, content->data_part4)); TRYF(ti85_send_ACK()); update_->cnt2++; update_->pbar(); return 0; }
static int del_var (CalcHandle* handle, VarRequest* vr) { unsigned int i; char *utf8; utf8 = ticonv_varname_to_utf8(handle->model, vr->name, vr->type); g_snprintf(update_->text, sizeof(update_->text), _("Deleting %s..."), utf8); g_free(utf8); update_label(); send_key(handle, 0x0040); // Quit send_key(handle, 0x0009); // Clear send_key(handle, 0x0009); // Clear send_key(handle, 0x003e); // Catalog send_key(handle, 0x009d); // D send_key(handle, 0x0004); // Down send_key(handle, 0x0004); // Down send_key(handle, 0x0004); // Down send_key(handle, 0x0005); // Enter for(i = 0; i < strlen(vr->name); i++) { char c = toupper(vr->name[i]); if(isdigit(c)) send_key(handle, (uint16_t)(0x008e + c - '0')); else send_key(handle, (uint16_t)(0x009a + c - 'A')); } send_key(handle, 0x0005); // Enter return 0; }
static int rename_var (CalcHandle* handle, VarRequest* oldname, VarRequest* newname) { char *utf81, *utf82; char *path1, *path2; int ret; ret = nsp_session_open(handle, NSP_SID_FILE_MGMT); if (ret) { return ret; } path1 = build_path(handle->model, oldname); path2 = build_path(handle->model, newname); utf81 = ticonv_varname_to_utf8(handle->model, path1, oldname->type); utf82 = ticonv_varname_to_utf8(handle->model, path2, newname->type); ticalcs_slprintf(update_->text, sizeof(update_->text), _("Renaming %s to %s..."), utf81, utf82); ticonv_utf8_free(utf82); ticonv_utf8_free(utf81); update_label(); ret = nsp_cmd_s_rename_file(handle, path1, path2); g_free(path2); g_free(path1); if (!ret) { ret = nsp_cmd_r_rename_file(handle); } DO_CLOSE_SESSION(handle); return ret; }
static int del_var (CalcHandle* handle, VarRequest* vr) { char *utf8; char *path; int ret; ret = nsp_session_open(handle, NSP_SID_FILE_MGMT); if (ret) { return ret; } path = build_path(handle->model, vr); utf8 = ticonv_varname_to_utf8(handle->model, path, vr->type); ticalcs_slprintf(update_->text, sizeof(update_->text), _("Deleting %s..."), utf8); ticonv_utf8_free(utf8); update_label(); ret = nsp_cmd_s_del_file(handle, path); g_free(path); if (!ret) { ret = nsp_cmd_r_del_file(handle); } DO_CLOSE_SESSION(handle); return ret; }
static int recv_var (CalcHandle* handle, CalcMode mode, FileContent* content, VarRequest* vr) { char *path; uint8_t *data = NULL; VarEntry *ve; char *utf8; int err; const char * dot_if_any = "."; TRYF(nsp_session_open(handle, SID_FILE_MGMT)); // Don't add a dot if this file type is unknown. if (vr->type >= NSP_MAXTYPES) dot_if_any = ""; path = g_strconcat("/", vr->folder, "/", vr->name, dot_if_any, tifiles_vartype2fext(handle->model, vr->type), NULL); utf8 = ticonv_varname_to_utf8(handle->model, path, vr->type); g_snprintf(update_->text, sizeof(update_->text), "%s", utf8); g_free(utf8); update_label(); err = nsp_cmd_s_get_file(handle, path); g_free(path); if (err) { return err; } TRYF(nsp_cmd_r_get_file(handle, &(vr->size))); TRYF(nsp_cmd_s_file_ok(handle)); if (vr->size) TRYF(nsp_cmd_r_file_contents(handle, &(vr->size), &data)); TRYF(nsp_cmd_s_status(handle, ERR_OK)); content->model = handle->model; strcpy(content->comment, tifiles_comment_set_single()); content->num_entries = 1; content->entries = tifiles_ve_create_array(1); ve = content->entries[0] = tifiles_ve_create(); memcpy(ve, vr, sizeof(VarEntry)); ve->data = tifiles_ve_alloc_data(ve->size); if (data && ve->data) { memcpy(ve->data, data, ve->size); } g_free(data); // XXX don't check the result of this call, to enable reception of variables from Nspires running OS >= 1.7. // Those versions send a martian packet: // * a src port never seen before in the conversation; // * an improper dest port; // * a 1-byte payload containing 02 (i.e. an invalid address for the next packet). // * .ack = 0x00 (instead of 0x0A). nsp_session_close(handle); return 0; }
static int new_folder (CalcHandle* handle, VarRequest* vr) { uint8_t data[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x40, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23 }; char varname[18]; char *utf8; tifiles_build_fullname(handle->model, varname, vr->folder, "a1234567"); utf8 = ticonv_varname_to_utf8(handle->model, vr->folder, -1); g_snprintf(update_->text, sizeof(update_->text), _("Creating %s..."), utf8); g_free(utf8); update_label(); // send empty expression TRYF(ti92_send_RTS(0x10, 0x00, varname)); TRYF(ti92_recv_ACK(NULL)); TRYF(ti92_recv_CTS()); TRYF(ti92_send_ACK()); TRYF(ti92_send_XDP(0x10, data)); TRYF(ti92_recv_ACK(NULL)); TRYF(ti92_send_EOT()); TRYF(ti92_recv_ACK(NULL)); // delete 'a1234567' variable strcpy(vr->name, "a1234567"); TRYF(del_var(handle, vr)); return 0; }
static int new_folder (CalcHandle* handle, VarRequest* vr) { char *utf8; char *path; int err; TRYF(nsp_session_open(handle, SID_FILE_MGMT)); path = g_strconcat("/", vr->folder, NULL); utf8 = ticonv_varname_to_utf8(handle->model, path, -1); g_snprintf(update_->text, sizeof(update_->text), _("Creating %s..."), utf8); g_free(utf8); update_label(); err = nsp_cmd_s_new_folder(handle, path); g_free(path); if (err) { return err; } TRYF(nsp_cmd_r_new_folder(handle)); TRYF(nsp_session_close(handle)); return 0; }
static int del_var (CalcHandle* handle, VarRequest* vr) { char *utf8; char *path; int err; const char * dot_if_any = "."; TRYF(nsp_session_open(handle, SID_FILE_MGMT)); // Don't add a dot if this file type is unknown. if (vr->type >= NSP_MAXTYPES) dot_if_any = ""; path = g_strconcat("/", vr->folder, "/", vr->name, dot_if_any, tifiles_vartype2fext(handle->model, vr->type), NULL); utf8 = ticonv_varname_to_utf8(handle->model, path, vr->type); g_snprintf(update_->text, sizeof(update_->text), _("Deleting %s..."), utf8); g_free(utf8); update_label(); err = nsp_cmd_s_del_file(handle, path); g_free(path); if (err) { return err; } TRYF(nsp_cmd_r_del_file(handle)); TRYF(nsp_session_close(handle)); return 0; }
void multimenu_button::select_options(boost::dynamic_bitset<> states) { assert(states.size() == values_.size()); toggle_states_ = states; update_config_from_toggle_states(); update_label(); }
static int new_folder (CalcHandle* handle, VarRequest* vr) { char *utf8; char *path; int ret; ret = nsp_session_open(handle, NSP_SID_FILE_MGMT); if (ret) { return ret; } path = g_strconcat("/", vr->folder, NULL); utf8 = ticonv_varname_to_utf8(handle->model, path, -1); ticalcs_slprintf(update_->text, sizeof(update_->text), _("Creating %s..."), utf8); ticonv_utf8_free(utf8); update_label(); ret = nsp_cmd_s_new_folder(handle, path); g_free(path); if (!ret) { ret = nsp_cmd_r_new_folder(handle); } DO_CLOSE_SESSION(handle); return ret; }
static int send_var (CalcHandle* handle, CalcMode mode, FileContent* content) { uint8_t status; gchar *path; int ret; VarEntry * entry; update_->cnt2 = 0; update_->max2 = 1; update_->pbar(); entry = content->entries[0]; if (!ticalcs_validate_varentry(entry)) { ticalcs_critical("%s: skipping invalid content entry #0", __FUNCTION__); return ERR_INVALID_PARAMETER; } if (entry->action == ACT_SKIP) { return 0; } //if (!strlen(entry->folder)) //{ // return ERR_ABORT; //} ret = nsp_session_open(handle, NSP_SID_FILE_MGMT); if (ret) { return ret; } path = build_path(handle->model, entry); ticonv_varname_to_utf8_sn(handle->model, path, update_->text, sizeof(update_->text), entry->type); update_label(); ret = nsp_cmd_s_put_file(handle, path, entry->size); g_free(path); if (!ret) { ret = nsp_cmd_r_put_file(handle); if (!ret) { ret = nsp_cmd_s_file_contents(handle, entry->size, entry->data); if (!ret) { ret = nsp_cmd_r_status(handle, &status); } } } DO_CLOSE_SESSION(handle); return ret; }
static int setup_interface( void ) { GtkWidget *window, *treeview, *select_entry, *spawn_dialog, *spawn_label; GtkCellRenderer *renderer; gtk_window_set_default_icon_name( "gnome-dev-keyboard" ); wl = window_list_new(); xml = glade_xml_new( PREFIX "/share/keyboardcast/keyboardcast.glade", NULL, NULL ); if( xml == NULL ) return 1; select_entry = glade_xml_get_widget( xml, "select-entry" ); treeview = glade_xml_get_widget( xml, "treeview" ); window = glade_xml_get_widget( xml, "window" ); spawn_dialog = glade_xml_get_widget( xml, "spawn-dialog" ); spawn_label = glade_xml_get_widget( xml, "spawn-label" ); if( select_entry == NULL || treeview == NULL || window == NULL || spawn_dialog == NULL || spawn_label == NULL ) return 1; gtk_tree_view_set_model( GTK_TREE_VIEW( treeview ), GTK_TREE_MODEL( wl ) ); renderer = window_list_toggle_renderer( wl ); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW( treeview ), -1, "✓", renderer, // ☑☒✓✔ "active", 1, NULL ); renderer = gtk_cell_renderer_text_new(); gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW( treeview ), -1, "Window Title", renderer, "text", 2, NULL ); glade_xml_signal_connect( xml, "key_event", G_CALLBACK( key_event ) ); glade_xml_signal_connect( xml, "gtk_exit", G_CALLBACK( gtk_exit ) ); glade_xml_signal_connect_data( xml, "expanded", G_CALLBACK( expanded ), window ); glade_xml_signal_connect_data( xml, "button_clicked", G_CALLBACK( button_clicked ), select_entry ); glade_xml_signal_connect_data( xml, "spawn_clicked", G_CALLBACK( spawn_clicked ), spawn_dialog ); glade_xml_signal_connect( xml, "terminal_toggled", G_CALLBACK( terminal_toggled ) ); glade_xml_signal_connect_data( xml, "update_label", G_CALLBACK( update_label ), spawn_label ); update_label( NULL, GTK_LABEL( spawn_label ) ); window_list_filter_by_process( wl, "gnome-terminal" ); gtk_widget_show_all( window ); return 0; }
void multimenu_button::toggle_state_changed() { assert(droplist_ != nullptr); toggle_states_ = droplist_->get_toggle_states(); fire(event::NOTIFY_MODIFIED, *this, nullptr); update_label(); }
/* Search the documentation pages for the string 'text', building the index if necessary */ void i7_search_window_search_documentation(I7SearchWindow *self) { GError *err; if(doc_index == NULL) { /* documentation index hasn't been built yet */ GFile *doc_file = i7_app_get_data_file_va(i7_app_get(), "Documentation", NULL); GFileEnumerator *docdir; if((docdir = g_file_enumerate_children(doc_file, "standard::*", G_FILE_QUERY_INFO_NONE, NULL, &err)) == NULL) { IO_ERROR_DIALOG(GTK_WINDOW(self), doc_file, err, _("opening documentation directory")); g_object_unref(doc_file); return; } start_spinner(self); GFileInfo *info; while((info = g_file_enumerator_next_file(docdir, NULL, &err)) != NULL) { const char *basename = g_file_info_get_name(info); const char *displayname = g_file_info_get_display_name(info); if(!g_str_has_suffix(basename, ".html") || (!g_str_has_prefix(basename, "doc") && !g_str_has_prefix(basename, "Rdoc"))) continue; char *label = g_strdup_printf(_("Please be patient, indexing %s..."), displayname); gtk_label_set_text(GTK_LABEL(self->search_text), label); g_free(label); while(gtk_events_pending()) gtk_main_iteration(); GFile *file = g_file_get_child(doc_file, basename); GSList *doctexts = html_to_ascii(file, g_str_has_prefix(basename, "R")); g_object_unref(file); if(doctexts != NULL) { GSList *iter; /* Append the entries to the documentation index and search them right now while we're at it */ for(iter = doctexts; iter != NULL; iter = g_slist_next(iter)) { doc_index = g_list_prepend(doc_index, iter->data); search_documentation(iter->data, self); } g_slist_free(doctexts); } } g_object_unref(doc_file); stop_spinner(self); update_label(self); } else { start_spinner(self); g_list_foreach(doc_index, (GFunc)search_documentation, self); stop_spinner(self); } return; }
void preferences_choicehandler(Evas *e, Evas_Object *parent,int choice, bool lp) { if(choice==0) { char *startval; asprintf(&startval,"%d",(int)(get_hpan_inc()*100)); HPanEntry(e,parent,startval); free(startval); } else if(choice==1) { char *startval; asprintf(&startval,"%d",(int)(get_vpan_inc()*100)); VPanEntry(e,parent,startval); free(startval); } else if(choice==2) { TrimmingDialog(e,parent); } else if(choice==3) { char *startval; asprintf(&startval,"%d",(int)(get_zoom_inc()*100)); ZoomEntry(e,parent,startval); free(startval); } else if(choice==4) { FitModeDialog(e,parent); } else if(choice==5) { set_antialias_mode(!get_antialias_mode()); update_label(e,preferenceschoicebox,5,OFF_ON_STRINGS[get_antialias_mode()]); show_cur_page(); } else if(choice==6) { set_reader_mode(!get_reader_mode()); update_label(e,preferenceschoicebox,6,OFF_ON_STRINGS[get_reader_mode()]); } }
PRIVATE void focus_in_handler(GtkRange *b, GdkEventFocus *event, gpointer userdata) { Control *c = userdata; GtkAdjustment *adj = gtk_range_get_adjustment(b); GtkWidget **widgets = c->data; if (c->events_flow) { int note = 127 - adj->value; update_label(widgets[SEQUENCE_LENGTH * 2], note); } }
static void tpaw_calendar_button_constructed (GObject *object) { TpawCalendarButton *self = (TpawCalendarButton *) object; G_OBJECT_CLASS (tpaw_calendar_button_parent_class)->constructed ( object); update_label (self); }
static int get_clock (CalcHandle* handle, CalcClock* _clock) { uint16_t pids[4] = { PID_CLK_SEC, PID_CLK_DATE_FMT, PID_CLK_TIME_FMT, PID_CLK_ON }; const int size = sizeof(pids) / sizeof(uint16_t); CalcParam **params; uint32_t calc_time; struct tm ref, *cur; time_t r, c, now; // get raw clock g_snprintf(update_->text, sizeof(update_->text), _("Getting clock...")); update_label(); params = cp_new_array(size); TRYF(cmd_s_param_request(handle, size, pids)); TRYF(cmd_r_param_data(handle, size, params)); if(!params[0]->ok) return ERR_INVALID_PACKET; // and computes calc_time = (params[0]->data[0] << 24) | (params[0]->data[1] << 16) | (params[0]->data[2] << 8) | (params[0]->data[3] << 0); time(&now); // retrieve current DST setting memcpy(&ref, localtime(&now), sizeof(struct tm));; ref.tm_year = 1997 - 1900; ref.tm_mon = 0; ref.tm_yday = 0; ref.tm_mday = 1; ref.tm_wday = 3; ref.tm_hour = 0; ref.tm_min = 0; ref.tm_sec = 0; //ref.tm_isdst = 1; r = mktime(&ref); c = r + calc_time; cur = localtime(&c); _clock->year = cur->tm_year + 1900; _clock->month = cur->tm_mon + 1; _clock->day = cur->tm_mday; _clock->hours = cur->tm_hour; _clock->minutes = cur->tm_min; _clock->seconds = cur->tm_sec; _clock->date_format = params[1]->data[0] == 0 ? 3 : params[1]->data[0]; _clock->time_format = params[2]->data[0] ? 24 : 12; _clock->state = params[3]->data[0]; cp_del_array(1, params); return 0; }
void mux_dialog::run() { auto &arg_list = static_cast<mmg_dialog *>(GetParent())->get_command_line_args(); opt_file_name = get_temp_settings_file_name(); try { const unsigned char utf8_bom[3] = {0xef, 0xbb, 0xbf}; wxFile opt_file{opt_file_name, wxFile::write}; opt_file.Write(utf8_bom, 3); opt_file.Write(wxT("--gui-mode\n")); for (size_t i = 1; i < arg_list.Count(); i++) { if (arg_list[i].IsEmpty()) opt_file.Write(wxT("#EMPTY#")); else { auto arg_utf8 = escape(to_utf8(arg_list[i])); opt_file.Write(arg_utf8.c_str(), arg_utf8.length()); } opt_file.Write(wxT("\n")); } } catch (mtx::mm_io::exception &ex) { wxString error; error.Printf(Z("Could not create a temporary file for mkvmerge's command line option called '%s' (error code %d, %s)."), opt_file_name.c_str(), errno, wxUCS(ex.error())); wxMessageBox(error, Z("File creation failed"), wxOK | wxCENTER | wxICON_ERROR); throw 0; } #if defined(SYS_WINDOWS) if (mtx::sys::get_windows_version() >= WINDOWS_VERSION_7) { m_taskbar_progress = new taskbar_progress_c(mdlg); m_taskbar_progress->set_state(TBPF_NORMAL); m_taskbar_progress->set_value(0, 100); } #endif // SYS_WINDOWS update_label(Z("Muxing in progress.")); m_start_time = mtx::sys::get_current_time_millis(); m_next_remaining_time_update = m_start_time + 8000; m_process = new mux_process{this}; m_pid = wxExecute(wxString::Format(wxT("\"%s\" \"@%s\""), arg_list[0].c_str(), opt_file_name.c_str()), wxEXEC_ASYNC, m_process); if (0 == m_pid) { wxCommandEvent evt(mux_process::event, mux_process::process_terminated); evt.SetInt(2); wxPostEvent(this, evt); } else { m_read_input_timer.SetOwner(this, ID_T_READ_INPUT); m_read_input_timer.Start(100); } ShowModal(); }
void multimenu_button::select_option(const unsigned option, const bool selected) { assert(option < values_.size()); if(option < toggle_states_.size()) { toggle_states_.resize(option + 1); } toggle_states_[option] = selected; update_config_from_toggle_states(); update_label(); }
static int send_var (CalcHandle* handle, CalcMode mode, FileContent* content) { int i; uint8_t rej_code; uint16_t status; char *utf8; update_->cnt2 = 0; update_->max2 = content->num_entries; for (i = 0; i < content->num_entries; i++) { VarEntry *entry = content->entries[i]; if(entry->action == ACT_SKIP) continue; TRYF(ti82_send_RTS(handle, (uint16_t)entry->size, entry->type, entry->name)); TRYF(ti82_recv_ACK(handle, &status)); TRYF(ti82_recv_SKP(handle, &rej_code)); TRYF(ti82_send_ACK(handle)); switch (rej_code) { case REJ_EXIT: return ERR_ABORT; case REJ_SKIP: continue; case REJ_MEMORY: return ERR_OUT_OF_MEMORY; default: // RTS break; } utf8 = ticonv_varname_to_utf8(handle->model, entry->name, entry->type); g_snprintf(update_->text, sizeof(update_->text), "%s", utf8); g_free(utf8); update_label(); TRYF(ti82_send_XDP(handle, entry->size, entry->data)); TRYF(ti82_recv_ACK(handle, &status)); TRYF(ti82_send_EOT(handle)); ticalcs_info(""); update_->cnt2 = i+1; update_->max2 = content->num_entries; update_->pbar(); } return 0; }
void fitmode_choicehandler(Evas *e, Evas_Object *parent,int choice, bool lp) { if(get_fit_mode()!=choice) { set_fit_mode(choice); update_label(e,preferenceschoicebox,4,FIT_STRINGS[choice]); evas_object_focus_set(choicebox_get_parent(e,parent),1); fini_choicebox(e,parent,false); show_cur_page(); } }
PRIVATE void value_changed_handler(GtkAdjustment *adj, gpointer userdata) { int step = (int) userdata; Control *c = gtk_object_get_data(GTK_OBJECT(adj), "Control"); GtkWidget **widgets = c->data; Data *data = c->g->data; if (c->events_flow) { int note = 127 - adj->value; data->pattern[data->edit][step] = note; update_label(widgets[SEQUENCE_LENGTH * 2], note); gen_update_controls(c->g, -1); } }
void nautilus_floating_bar_set_label (NautilusFloatingBar *self, const gchar *label) { if (g_strcmp0 (self->priv->label, label) != 0) { g_free (self->priv->label); self->priv->label = g_strdup (label); g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_LABEL]); update_label (self); } }
static int send_var (CalcHandle* handle, CalcMode mode, FileContent* content) { char *utf8; uint8_t status; const char * dot_if_any = "."; update_->cnt2 = 0; update_->max2 = 1; update_->pbar(); { VarEntry *ve = content->entries[0]; gchar *path; int err; if(ve->action == ACT_SKIP) return 0; if(!strlen(ve->folder)) return ERR_ABORT; TRYF(nsp_session_open(handle, SID_FILE_MGMT)); // Don't add a dot if this file type is unknown. if (ve->type >= NSP_MAXTYPES) dot_if_any = ""; path = g_strconcat("/", ve->folder, "/", ve->name, dot_if_any, tifiles_vartype2fext(handle->model, ve->type), NULL); utf8 = ticonv_varname_to_utf8(handle->model, path, ve->type); g_snprintf(update_->text, sizeof(update_->text), "%s", utf8); g_free(utf8); update_label(); err = nsp_cmd_s_put_file(handle, path, ve->size); g_free(path); if (err) { return err; } TRYF(nsp_cmd_r_put_file(handle)); TRYF(nsp_cmd_s_file_contents(handle, ve->size, ve->data)); TRYF(nsp_cmd_r_status(handle, &status)); TRYF(nsp_session_close(handle)); } return 0; }
//bottom trimming entrybox void bottomtrim_entryhandler(Evas *e, Evas_Object *obj,char *value) { if(value) { long numval=strtol(value,NULL,10); set_bottomtrim((int)numval); char *tempo; asprintf(&tempo,"%spx",value); update_label(e,trimmingchoicebox,3,tempo); free(tempo); free(value); show_cur_page(); } }
static int send_var (CalcHandle* handle, CalcMode mode, FileContent* content) { int i; uint16_t status; char *utf8; update_->cnt2 = 0; update_->max2 = content->num_entries; for (i = 0; i < content->num_entries; i++) { VarEntry *entry = content->entries[i]; uint8_t buffer[65536 + 4] = { 0 }; char varname[18]; if(entry->action == ACT_SKIP) continue; if (mode & MODE_LOCAL_PATH) strcpy(varname, entry->name); else tifiles_build_fullname(handle->model, varname, entry->folder, entry->name); utf8 = ticonv_varname_to_utf8(handle->model, varname, entry->type); g_snprintf(update_->text, sizeof(update_->text), "%s", utf8); g_free(utf8); update_label(); TRYF(ti92_send_VAR(entry->size, entry->type, varname)); TRYF(ti92_recv_ACK(NULL)); TRYF(ti92_recv_CTS()); TRYF(ti92_send_ACK()); memcpy(buffer + 4, entry->data, entry->size); TRYF(ti92_send_XDP(entry->size + 4, buffer)); TRYF(ti92_recv_ACK(&status)); TRYF(ti92_send_EOT()); TRYF(ti92_recv_ACK(NULL)); ticalcs_info(""); update_->cnt2 = i+1; update_->max2 = content->num_entries; update_->pbar(); } return 0; }
/* copied from uim-cand-win-gtk.c */ static gboolean tree_selection_change(GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, gboolean path_currently_selected, gpointer data) { /* candidate_window *cwin = data; */ gint *indicies; gint idx; if (!cwin) return TRUE; indicies = gtk_tree_path_get_indices(path); g_return_val_if_fail(indicies, TRUE); idx = *indicies + cwin->display_limit * cwin->page_index; if (!path_currently_selected && cwin->candidate_index != idx) { if (cwin->candidate_index >= 0) { cwin->candidate_index = idx; g_signal_emit(G_OBJECT(cwin), cand_win_gtk_signals[INDEX_CHANGED_SIGNAL], 0); } update_label(cwin); if (cwin->candidate_index < 0) return FALSE; else return TRUE; } else { update_label(cwin); return TRUE; } }
WFile::WFile(File *_file, Player *_player, Ui_WMain *_main_ui) :file_(_file), player_(_player), main_ui_(_main_ui) { file_->setParent(this); ui->setupUi(this); ui->scroll_area->setFocusPolicy(Qt::NoFocus); ui->scroll_area->horizontalScrollBar()->setFocusPolicy(Qt::NoFocus); ui->scroll_area->verticalScrollBar()->setFocusPolicy(Qt::NoFocus); connect(file_, SIGNAL(acted()), this, SLOT(update_label())); connect(file_, SIGNAL(acted()), this, SLOT(update_tracks())); update_tracks(); }
static int button_clicked(struct rtb_element *tgt, const struct rtb_event *_e, void *ctx) { const struct rtb_button_event *e = RTB_EVENT_AS(_e, rtb_button_event); if (e->mod_keys) { if (clicks > 0) clicks--; } else clicks++; update_label(); return 0; }