LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_COMMAND: /* did we get a button press? */ if (((HWND)lParam) && (HIWORD(wParam) == BN_CLICKED)) { int btn = LOWORD(wParam); switch (btn) { case BTN_DISABLE_REDUCEPING: disable_reduceping(); update_ui(hwnd); break; case BTN_ENABLE_REDUCEPING: enable_reduceping(); update_ui(hwnd); break; } } break; case WM_CLOSE: DestroyWindow(hwnd); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hwnd, msg, wParam, lParam); } return 0; }
static void set_text (const char *text, gsize len) { gtk_text_buffer_set_text (buffer, text, len); file_changed = FALSE; update_ui (); }
static void reset() { tick_timer_service_unsubscribe(); state.running = 0; state.round = 0; if (!stretch_settings.program) { layer_set_hidden(text_layer_get_layer(ui.middle_text), true); Layer *image_layer = text_layer_get_layer(ui.time_text); GRect image_frame = layer_get_frame(image_layer); image_frame.origin.x = (ui.bounds.size.w / 2) - 40; image_frame.origin.y = (ui.bounds.size.h / 2) - 25; layer_set_frame(image_layer, image_frame); } if (stretch_settings.prepare == 0) { state.round_time = stretch_settings.time; state.stretch = 1; } else { state.round_time = stretch_settings.prepare; state.stretch = 0; } update_ui(); }
static void timer_callback(struct tm *tick_time, TimeUnits units_changed) { if (state.round_time == 0) { if (state.stretch && stretch_settings.prepare != 0) { state.round++; state.round_time = stretch_settings.prepare; vibes_long_pulse(); text_layer_set_text(ui.top_text, "Prepare"); state.stretch = 0; } else { if (stretch_settings.prepare == 0) { state.round++; } state.round_time = stretch_settings.time; vibes_short_pulse(); text_layer_set_text(ui.top_text, "Stretch"); state.stretch = 1; } update_ui(); } if (state.running) { update_time_ui(); } }
void on_open_file(const wstring& file_path, unsigned __int64 size) { CriticalSectionLock lock(sync); this->file_path = file_path; file_total = size; file_completed = 0; update_ui(); }
static void gedit_spell_plugin_update_state (GeditWindowActivatable *activatable) { gedit_debug (DEBUG_PLUGINS); update_ui (GEDIT_SPELL_PLUGIN (activatable)); }
static void pluma_spell_plugin_update_state (PeasActivatable *activatable) { pluma_debug (DEBUG_PLUGINS); update_ui (PLUMA_SPELL_PLUGIN (activatable)); }
void cc_wacom_mapping_panel_set_device (CcWacomMappingPanel *self, GsdWacomDevice *device) { self->priv->device = device; update_ui (self); }
static void save_file (const char *save_filename) { char *text = get_text (); GtkWidget *error_dialog; GError *error; error = NULL; if (g_file_set_contents (save_filename, text, -1, &error)) { if (save_filename != filename) { g_free (filename); filename = g_strdup (save_filename); } file_changed = FALSE; update_ui (); } else { error_dialog = gtk_message_dialog_new (GTK_WINDOW (main_window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "Error saving to file %s:\n%s", filename, error->message); g_signal_connect (error_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL); gtk_widget_show (error_dialog); g_error_free (error); } }
void WarriorNode::stand_auto() { if (_current_state == stand) return; _current_state = stand; update_ui(); }
static void cmd_O(key_info_t key_info, keys_info_t *keys_info) { int t = start_pos; start_pos = view->list_pos; view->list_pos = t; update_ui(); }
/* open_default will make function reload default session files on close */ void project_close(gboolean open_default) { GSList *node; g_return_if_fail(app->project != NULL); ui_set_statusbar(TRUE, _("Project \"%s\" closed."), app->project->name); /* use write_config() to save project session files */ if (!write_config(FALSE)) g_warning("Project file \"%s\" could not be written", app->project->file_name); /* remove project filetypes build entries */ if (app->project->build_filetypes_list != NULL) { g_ptr_array_foreach(app->project->build_filetypes_list, remove_foreach_project_filetype, NULL); g_ptr_array_free(app->project->build_filetypes_list, FALSE); } /* remove project non filetype build menu items */ build_remove_menu_item(GEANY_BCS_PROJ, GEANY_GBG_NON_FT, -1); build_remove_menu_item(GEANY_BCS_PROJ, GEANY_GBG_EXEC, -1); g_free(app->project->name); g_free(app->project->description); g_free(app->project->file_name); g_free(app->project->base_path); g_free(app->project); app->project = NULL; foreach_slist(node, stash_groups) stash_group_free(node->data); g_slist_free(stash_groups); stash_groups = NULL; apply_editor_prefs(); /* ensure that global settings are restored */ if (project_prefs.project_session) { /* close all existing tabs first */ document_close_all(); /* after closing all tabs let's open the tabs found in the default config */ if (open_default && cl_options.load_session) { configuration_reload_default_session(); configuration_open_files(); /* open a new file if no other file was opened */ document_new_file_if_non_open(); ui_focus_current_document(); } } g_signal_emit_by_name(geany_object, "project-close"); update_ui(); }
void jt_init() { lh_init(LayoutChromaticFixed); sth_init(); ksh_init(); th_init(); setup_defaults(); update_ui(); }
void WarriorNode::turn_to(const cocos2d::Vec2& position) { direction dir = calucate_direction(position); if (_current_direction == dir && _current_state == stand) return; _current_direction = dir; _current_state = stand; update_ui(); }
void WarriorNode::move_to(const cocos2d::Vec2& position, const std::function<void()>& callback) { runAction(Sequence::create(MoveTo::create(getPosition().distance(position) / MOVE_SPEED, position), CallFunc::create(callback), nullptr)); direction dir = calucate_direction(position); if (_current_direction == dir && _current_state == run) return; _current_direction = dir; _current_state = run; update_ui(); }
// remount /system void Dialog::on_pushButton_remount_system_released() { if(!check_if_can_run(false)) return; int ret = backup::do_cmd_return_str("adb shell busybox mount -o remount,rw /system 2>&1", ui->textEdit_result); //int ret = backup::do_remount_system(); if(ret != 0) update_result(msg_alert, "Remount system Error!\n"); else update_result(msg_succeed, "Remount system ok!\n"); update_ui(); }
// reboot device void Dialog::on_pushButton_reboot_released() { if(!check_if_can_run(false)) return; int ret = backup::do_cmd_return_str("adb reboot 2>&1", ui->textEdit_result); if(ret != 0) update_result(msg_alert, "Reboot failed!"); else update_result(msg_succeed, "Reboot succeed!"); update_ui(); }
bool WarriorNode::init(const std::string& name) { if (cocostudio::Armature::init(name)) { _current_direction = right; _current_state = stand; update_ui(); return true; } else { return false; } }
// public funtions void jt_handle_pad_event(u8 index, u8 value) { if (value == 0) //ignore up state return; lh_handle_index(index); sth_handle_index(index); ksh_handle_index(index); th_set_key_signature(ksh_get_selected_key_signature()); th_handle_index(index); //update ui update_ui(); }
/* Reads the given filename and creates a new project with the data found in the file. * At this point there should not be an already opened project in Geany otherwise it will just * return. * The filename is expected in the locale encoding. */ static gboolean load_config(const gchar *filename) { GKeyFile *config; GeanyProject *p; GSList *node; /* there should not be an open project */ g_return_val_if_fail(app->project == NULL && filename != NULL, FALSE); config = g_key_file_new(); if (! g_key_file_load_from_file(config, filename, G_KEY_FILE_NONE, NULL)) { g_key_file_free(config); return FALSE; } p = create_project(); foreach_slist(node, stash_groups) stash_group_load_from_key_file(node->data, config); p->name = utils_get_setting_string(config, "project", "name", GEANY_STRING_UNTITLED); p->description = utils_get_setting_string(config, "project", "description", ""); p->file_name = utils_get_utf8_from_locale(filename); p->base_path = utils_get_setting_string(config, "project", "base_path", ""); p->file_patterns = g_key_file_get_string_list(config, "project", "file_patterns", NULL, NULL); p->long_line_behaviour = utils_get_setting_integer(config, "long line marker", "long_line_behaviour", 1 /* follow global */); p->long_line_column = utils_get_setting_integer(config, "long line marker", "long_line_column", editor_prefs.long_line_column); apply_editor_prefs(); build_load_menu(config, GEANY_BCS_PROJ, (gpointer)p); if (project_prefs.project_session) { /* save current (non-project) session (it could has been changed since program startup) */ configuration_save_default_session(); /* now close all open files */ document_close_all(); /* read session files so they can be opened with configuration_open_files() */ configuration_load_session_files(config, FALSE); ui_focus_current_document(); } g_signal_emit_by_name(geany_object, "project-open", config); g_key_file_free(config); update_ui(); return TRUE; }
static void select_handler(ClickRecognizerRef crr, void *context) { s_current_field++; if (s_current_field > 3) { s_ip_set = true; persist_write_data(IP_PERSIST_KEY, s_ip, 4); send_ip(s_ip); click_down_handler = click_handler; click_up_handler = click_handler; click_select_handler = click_handler; window_set_click_config_provider(s_window, (ClickConfigProvider) config_provider); } update_ui(); }
void gameover::update() { string cs = "Current score: " + to_string(score_system::get_score()); string ms = "Max score: " + to_string(score_system::get_max()); auto csoff = cs.length() * 10.7; auto msoff = ms.length() * 10.7; pool::get().draw_text("font.ttf", 30, cs, vec2(pool::get().screen.x / 2 - csoff, pool::get().screen.y / 2 + 300)); pool::get().draw_text("font.ttf", 30, ms, vec2(pool::get().screen.x / 2 - msoff, pool::get().screen.y / 2 + 250)); update_ui(); }
static void start() { state.running = 1; vibes_short_pulse(); if (state.stretch) { text_layer_set_text(ui.top_text, "Stretch"); } else { text_layer_set_text(ui.top_text, "Prepare"); } update_ui(); update_time_ui(); tick_timer_service_subscribe(SECOND_UNIT, &timer_callback); }
void Dialog::on_create() { // if debug debug = false; fill_all_push_button(push_button, PUSH_BUTTON_MAX_NUMBER); // init sth. is_path_saved = true; is_current_thread_run = false; is_can_run = true; // update ui update_ui(); ui->textEdit_result->setFont (QFont ("OldEnglish", 8)); }
void Dialog::on_pushButton_edit_path_released() { if(ui->lineEdit_android_source->isEnabled()) { ui->lineEdit_android_source->setDisabled(true); ui->lineEdit_target_product->setDisabled(true); ui->pushButton_edit_path->setText("Edit"); is_path_saved = true; } else { ui->lineEdit_android_source->setDisabled(false); ui->lineEdit_target_product->setDisabled(false); ui->pushButton_edit_path->setText("Save"); // if path is not exist when app start. if(check_path() == false) ui->pushButton_edit_path->setDisabled(true); is_path_saved = false; } update_ui(); }
static void budgie_media_label_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { BudgieMediaLabel *self; self = BUDGIE_MEDIA_LABEL(object); switch (prop_id) { case PROP_INFO: self->info = g_value_get_pointer((GValue*)value); update_ui(self); break; case PROP_PLAYING: self->playing = g_value_get_boolean((GValue*)value); budgie_media_label_set_playing(self, self->playing); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
void WarriorNode::fight_auto(int times, const std::function<void()>& callback) { if (_current_state == fight) return; _current_state = fight; update_ui(); // 此处要使用不会被释放掉的变量来记录次数,局部变量会导致bug出现 static int fight_times = 0; // 用于计算执行多少次fight动画后调用回掉函数 fight_times = times; auto function = [&, callback](cocostudio::Armature *armature, cocostudio::MovementEventType movementType, const std::string& movementID) { if ((movementID == "Sfight" || movementID == "Bfight" || movementID == "Ffight") && movementType == cocostudio::LOOP_COMPLETE && --fight_times == 0) { int test = fight_times; ++test; if (callback) callback(); } }; getAnimation()->setMovementEventCallFunc(function); }
static void gedit_spell_plugin_activate (GeditWindowActivatable *activatable) { GeditSpellPlugin *plugin; GeditSpellPluginPrivate *priv; GList *views, *l; gedit_debug (DEBUG_PLUGINS); plugin = GEDIT_SPELL_PLUGIN (activatable); priv = plugin->priv; g_action_map_add_action_entries (G_ACTION_MAP (priv->window), action_entries, G_N_ELEMENTS (action_entries), activatable); priv->message_cid = gtk_statusbar_get_context_id (GTK_STATUSBAR (gedit_window_get_statusbar (priv->window)), "spell_plugin_message"); update_ui (plugin); views = gedit_window_get_views (priv->window); for (l = views; l != NULL; l = g_list_next (l)) { GeditView *view = GEDIT_VIEW (l->data); set_auto_spell_from_metadata (plugin, view); } priv->tab_added_id = g_signal_connect (priv->window, "tab-added", G_CALLBACK (tab_added_cb), activatable); priv->tab_removed_id = g_signal_connect (priv->window, "tab-removed", G_CALLBACK (tab_removed_cb), activatable); }
void update_completed(unsigned __int64 completed) { this->completed = completed; update_ui(); }
void update_total(unsigned __int64 total) { this->total = total; update_ui(); }