void dump_objects(tmx_object *o, int depth) { char padding[11]; mk_padding(padding, depth); printf("\n%s" "object={", padding); if (!o) { printf(" (NULL) }"); } else { printf("\n%s\t" "name='%s'", padding, o->name); printf("\n%s\t" "shape=", padding); print_shape(o->shape); printf("\n%s\t" "x=%f", padding, o->x); printf("\n%s\t" "y=%f", padding, o->y); printf("\n%s\t" "number of points='%d'", padding, o->points_len); printf("\n%s\t" "rotation=%f", padding, o->rotation); printf("\n%s\t" "visible=%s", padding, str_bool(o->visible)); if (o->points_len) { printf("\n%s\t" "points=", padding); dump_points(o->points, o->points_len); } dump_prop(o->properties, depth+1); printf("\n%s}", padding); } if (o && o->next) { dump_objects(o->next, depth); } }
void dump_layer(tmx_layer *l, unsigned int tc) { unsigned int i; printf("\nlayer={"); if (!l) { printf(" (NULL) }"); } else { printf("\n\t" "name='%s'", l->name); printf("\n\t" "visible=%s", str_bool(l->visible)); printf("\n\t" "opacity='%f'", l->opacity); if (l->type == L_LAYER && l->content.gids) { printf("\n\t" "type=Layer" "\n\t" "tiles="); for (i=0; i<tc; i++) { printf("%d,", l->content.gids[i] & TMX_FLIP_BITS_REMOVAL); } } else if (l->type == L_OBJGR) { printf("\n\t" "color=#%.6X", l->content.objgr->color); printf("\n\t" "draworder="); print_draworder(l->content.objgr->draworder); printf("\n\t" "type=ObjectGroup"); dump_objects(l->content.objgr->head, 1); } else if (l->type == L_IMAGE) { printf("\n\t" "x_offset=%d", l->x_offset); printf("\n\t" "y_offset=%d", l->y_offset); printf("\n\t" "type=ImageLayer"); dump_image(l->content.image, 1); } dump_prop(l->properties, 1); printf("\n}"); } if (l) { if (l->next) dump_layer(l->next, tc); } }
void dump_image(tmx_image *i, int depth) { char padding[11]; mk_padding(padding, depth); printf("\n%s" "image={", padding); if (i) { printf("\n%s\t" "source='%s'", padding, i->source); printf("\n%s\t" "height=%lu", padding, i->height); printf("\n%s\t" "width=%lu", padding, i->width); printf("\n%s\t" "uses_trans=%s", padding, str_bool(i->uses_trans)); printf("\n%s\t" "trans=#%.6X", padding, i->trans); printf("\n%s}", padding); } else { printf(" (NULL) }"); } }
void roles_load_selection(Logbook *logb) { GtkTreeIter iter; GtkTreeModel *treemod; gchar *id=NULL, *ident=NULL, *name=NULL, *pic=NULL, *sic=NULL, *fe=NULL, *solo=NULL, *dual=NULL, *instruct=NULL, *total=NULL; if (gtk_tree_selection_get_selected (logb->roles_selection, &treemod, &iter)) { gtk_tree_model_get(treemod, &iter, ROLES_COL_ID, &id, ROLES_COL_IDENT, &ident, ROLES_COL_NAME, &name, ROLES_COL_PIC, &pic, ROLES_COL_SIC, &sic, ROLES_COL_FE, &fe, ROLES_COL_SOLO, &solo, ROLES_COL_DUAL, &dual, ROLES_COL_INSTRUCT, &instruct, ROLES_COL_TOTAL, &total, -1); } gtk_entry_set_text(GTK_ENTRY(logb->roles_ident), EMPTY_IF_NULL(ident)); gtk_entry_set_text(GTK_ENTRY(logb->roles_name), EMPTY_IF_NULL(name)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(logb->roles_pic), str_bool(pic)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(logb->roles_sic), str_bool(sic)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(logb->roles_fe), str_bool(fe)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(logb->roles_solo), str_bool(solo)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(logb->roles_dual), str_bool(dual)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(logb->roles_instruct), str_bool(instruct)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(logb->roles_total), str_bool(total)); g_free(id); g_free(ident); g_free(name); g_free(pic); g_free(sic); g_free(fe); g_free(solo); g_free(dual); g_free(instruct); g_free(total); }
//形成变量内部名称和值的映射 void Context::Assign(VariableExp* ve,bool b) { m_varMap.insert(str_bool(ve->m_name, b)); }
void cfg_set_opt(char *key, char *value, int initial) { #ifdef USE_XFT XftFont *newxftfont; #endif XFontStruct *newfont; long i; if(strcmp(key, "resetkeys") == 0) keys_free(); if(!value) return; if(strcmp(key, "key") == 0) key_bind(value); if(strcmp(key, "exec") == 0 && initial) spawn(value); if(strcmp(key, "exec_onload") == 0) spawn(value); if(strcmp(key, "background") == 0) str_color(value, &bg); if(strcmp(key, "inactive_background") == 0) str_color(value, &ibg); if(strcmp(key, "foreground") == 0) str_color(value, &fg); if(strcmp(key, "inactive_foreground") == 0) str_color(value, &ifg); if(strcmp(key, "border_color") == 0) str_color(value, &bfg); if(strcmp(key, "inactive_border_color") == 0) str_color(value, &ibfg); if(strcmp(key, "font") == 0) { newfont = XLoadQueryFont(dpy, value); if(newfont) { if(font) XFreeFont(dpy, font); #ifdef USE_XFT if(xftfont) { XftFontClose(dpy, xftfont); xftfont = NULL; } #endif font = newfont; } #ifdef USE_XFT else { newxftfont = XftFontOpenName(dpy, screen, value); if(newxftfont) { if(xftfont) XftFontClose(dpy, xftfont); if(font) { XFreeFont(dpy, font); font = NULL; } xftfont = newxftfont; } } #endif } if(strcmp(key, "border_width") == 0) { i = strtol(value, NULL, 0); if(i >= 0) border_width = i; } if(strcmp(key, "border_spacing") == 0) { i = strtol(value, NULL, 0); if(i >= 0) border_spacing = i; } if(strcmp(key, "title_spacing") == 0) { i = strtol(value, NULL, 0); if(i >= 0) title_spacing = i; } if(strcmp(key, "button_spacing") == 0) { i = strtol(value, NULL, 0); if(i >= 0) button_spacing = i; } if(strcmp(key, "wlist_margin") == 0) { i = strtol(value, NULL, 0); if(i >= 0) wlist_margin = i; } if(strcmp(key, "wlist_maxwidth") == 0) { i = strtol(value, NULL, 0); if(i >= 0) wlist_maxwidth = i; } if(strcmp(key, "doubleclick_time") == 0) { i = strtol(value, NULL, 0); if(i > 0) doubleclick_time = i; } if(strcmp(key, "snap") == 0) snapat = strtol(value, NULL, 0); if(strcmp(key, "desktops") == 0) { i = strtol(value, NULL, 0); if(i > 0) dc = i; } if(strcmp(key, "ewmh_screen") == 0) { i = strtol(value, NULL, 0); if(i > 0) ewmh_screen = i; } if(strcmp(key, "button1") == 0) str_action(value, &button1); if(strcmp(key, "button2") == 0) str_action(value, &button2); if(strcmp(key, "button3") == 0) str_action(value, &button3); if(strcmp(key, "button4") == 0) str_action(value, &button4); if(strcmp(key, "button5") == 0) str_action(value, &button5); if(strcmp(key, "double1") == 0) str_action(value, &double1); if(strcmp(key, "double2") == 0) str_action(value, &double2); if(strcmp(key, "double3") == 0) str_action(value, &double3); if(strcmp(key, "double4") == 0) str_action(value, &double4); if(strcmp(key, "double5") == 0) str_action(value, &double5); if(strcmp(key, "root_button1") == 0) str_action(value, &root_button1); if(strcmp(key, "root_button2") == 0) str_action(value, &root_button2); if(strcmp(key, "root_button3") == 0) str_action(value, &root_button3); if(strcmp(key, "root_button4") == 0) str_action(value, &root_button4); if(strcmp(key, "root_button5") == 0) str_action(value, &root_button5); if(strcmp(key, "root_double1") == 0) str_action(value, &root_double1); if(strcmp(key, "root_double2") == 0) str_action(value, &root_double2); if(strcmp(key, "root_double3") == 0) str_action(value, &root_double3); if(strcmp(key, "root_double4") == 0) str_action(value, &root_double4); if(strcmp(key, "root_double5") == 0) str_action(value, &double5); if(strcmp(key, "click_focus") == 0) str_bool(value, &click_focus); if(strcmp(key, "click_raise") == 0) str_bool(value, &click_raise); if(strcmp(key, "focus_new") == 0) str_bool(value, &focus_new); if(strcmp(key, "fullscreen_stacking") == 0) str_fsstacking(value, &fullscreen_stacking); if(strcmp(key, "taskbar_ontop") == 0) str_bool(value, &taskbar_ontop); if(strcmp(key, "center_title") == 0) str_bool(value, ¢er_title); if(strcmp(key, "center_wlist_items") == 0) str_bool(value, ¢er_wlist_items); if(strcmp(key, "map_center") == 0) str_bool(value, &map_center); if(strcmp(key, "drag_warp") == 0) str_bool(value, &drag_warp); if(strcmp(key, "allow_focus_stealing") == 0) str_bool(value, &allow_focus_stealing); if(strcmp(key, "correct_center") == 0) str_bool(value, &correct_center); if(strcmp(key, "correct_center_unmanaged") == 0) str_bool(value, &correct_center_unmanaged); if(strcmp(key, "correct_center_separate") == 0) str_bool(value, &correct_center_separate); if(strcmp(key, "click_root") == 0) str_bool(value, &click_root); if(strcmp(key, "mouse_modifier") == 0) str_key(&value, &mousemodmask); if(strcmp(key, "no_snap_modifier") == 0) str_key(&value, &nosnapmodmask); if(strcmp(key, "ignore_modifier") == 0) { if(mod_ignore) { nmod_ignore = 0; free((void *) mod_ignore); mod_ignore = NULL; } while(value) { mod_ignore = (unsigned int *) _realloc((void *) mod_ignore, (nmod_ignore + nmod_ignore + 1) * sizeof(unsigned int)); skiprealloc: mod_ignore[nmod_ignore] = str_modifier(eat(&value, " \t")); if(mod_ignore[nmod_ignore] == None) goto skiprealloc; for(i = 0; i < nmod_ignore; i++) mod_ignore[nmod_ignore + 1 + i] = mod_ignore[i] | mod_ignore[nmod_ignore]; nmod_ignore += nmod_ignore + 1; } } if(strcmp(key, "buttons_left") == 0) str_buttons(value, &buttons_left, &nbuttons_left); if(strcmp(key, "buttons_right") == 0) str_buttons(value, &buttons_right, &nbuttons_right); }