void edit_interface_rep::draw_text (renderer ren, rectangles& l) { nr_painted=0; bool tp_found= false; tree bg= get_init_value (BG_COLOR); ren->set_background_pattern (bg); refresh_needed= do_animate; refresh_next = next_animate; eb->redraw (ren, eb->find_box_path (tp, tp_found), l); do_animate = refresh_needed; next_animate= refresh_next; }
void edit_interface_rep::handle_clear (SI x1, SI y1, SI x2, SI y2) { renderer win= get_renderer (this); x1 *= sfactor; y1 *= sfactor; x2 *= sfactor; y2 *= sfactor; win->set_shrinking_factor (sfactor); tree bg= get_init_value (BG_COLOR); win->set_background_pattern (bg); win->clear_pattern (max (eb->x1, x1), max (eb->y1, y1), min (eb->x2, x2), min (eb->y2, y2)); draw_surround (win, rectangle (x1, y1, x2, y2)); win->set_shrinking_factor (1); }
void edit_interface_rep::draw_pre (renderer ren, rectangle r) { // draw surroundings tree bg= get_init_value (BG_COLOR); ren->set_background_pattern (bg); clear_pattern_rectangles (ren, rectangles (translate (r, ren->ox, ren->oy))); draw_surround (ren, r); // predraw cursor renderer win= get_renderer (this); draw_cursor (ren); rectangles l= copy_always; while (!is_nil (l)) { rectangle lr (l->item); win->put_shadow (ren, lr->x1, lr->y1, lr->x2, lr->y2); l= l->next; } }
static int __devinit pm8xxx_led_probe(struct platform_device *pdev) { const struct led_platform_data *pcore_data; struct led_info *curr_led; struct pm8xxx_led_config *led_cfg; struct pm8xxx_led_data *led, *led_dat; struct leds_dev_data *info; struct pm8xxx_led_platform_data *pdata ; int rc = -1, i = 0; pdata = pdev->dev.platform_data; if (pdata == NULL) { dev_err(&pdev->dev, "platform data not supplied\n"); return -EINVAL; } pcore_data = pdata->led_core; if (pcore_data->num_leds != pdata->num_configs) { dev_err(&pdev->dev, "#no. of led configs and #no. of led" "entries are not equal\n"); return -EINVAL; } led = kcalloc(pcore_data->num_leds, sizeof(*led), GFP_KERNEL); if (led == NULL) { dev_err(&pdev->dev, "failed to alloc memory\n"); return -ENOMEM; } info = kzalloc(sizeof(*info), GFP_KERNEL); if (!info) { dev_err(&pdev->dev, "fail to memory allocation.\n"); rc = -ENOMEM; goto fail_mem_check; } info->pdata = pdata; info->led = led; for (i = 0; i < pcore_data->num_leds; i++) { curr_led = &pcore_data->leds[i]; led_dat = &led[i]; led_cfg = &pdata->configs[i]; led_dat->id = led_cfg->id; led_dat->pwm_channel = led_cfg->pwm_channel; led_dat->pwm_period_us = led_cfg->pwm_period_us; led_dat->pwm_duty_cycles = led_cfg->pwm_duty_cycles; if (!((led_dat->id >= PM8XXX_ID_LED_KB_LIGHT) && (led_dat->id <= PM8XXX_ID_FLASH_LED_1))) { dev_err(&pdev->dev, "invalid LED ID (%d) specified\n", led_dat->id); rc = -EINVAL; goto fail_id_check; } led_dat->cdev.name = curr_led->name; led_dat->cdev.default_trigger = curr_led->default_trigger; led_dat->cdev.brightness_set = pm8xxx_led_set; led_dat->cdev.brightness_get = pm8xxx_led_get; led_dat->cdev.brightness = LED_OFF; led_dat->cdev.flags = curr_led->flags; led_dat->dev = &pdev->dev; rc = get_init_value(led_dat, &led_dat->reg); if (rc < 0) goto fail_id_check; rc = pm8xxx_set_led_mode_and_max_brightness(led_dat, led_cfg->mode, led_cfg->max_current); if (rc < 0) goto fail_id_check; mutex_init(&led_dat->lock); INIT_WORK(&led_dat->work, pm8xxx_led_work); if (led_dat->id == PM8XXX_ID_LED_KB_LIGHT) __pm8xxx_led_work(led_dat, LED_FULL); else __pm8xxx_led_work(led_dat, LED_OFF); } platform_set_drvdata(pdev, info); led_virtual_dev(info); low_powermode = 0; return 0; fail_id_check: if (i > 0) { for (i = i - 1; i >= 0; i--) { mutex_destroy(&led[i].lock); led_classdev_unregister(&led[i].cdev); if (led[i].pwm_dev != NULL) pwm_free(led[i].pwm_dev); } } kfree(info); fail_mem_check: kfree(led); return rc; }
void edit_interface_rep::set_left_footer () { tree s= concat (); double base_sz= get_env_int (FONT_BASE_SIZE); double sz= get_env_double (FONT_SIZE); /* tree the_style= get_style (); for (int i=0; i<arity (the_style); i++) s << " " << as_string (the_style[i]); */ string mode= get_env_string (MODE); string lan = get_env_string (MODE_LANGUAGE (mode)); if (mode == "prog") s << "program"; else if (as_string (get_init_value (MODE_LANGUAGE (mode))) != lan) s << " " << lan; else s << " " << mode; if ((mode == "text") || (mode == "src")) { s << " " << get_env_string (FONT); append_left_footer (s, FONT_FAMILY); s << " " << as_string ((int) ((base_sz+0.5)*sz)); append_left_footer (s, FONT_SERIES); append_left_footer (s, FONT_SHAPE); } else if (mode == "math") { s << " " << get_env_string (MATH_FONT); append_left_footer (s, MATH_FONT_FAMILY); s << " " << as_string ((int) ((base_sz+0.5)*sz)); append_left_footer (s, MATH_FONT_SERIES); append_left_footer (s, MATH_FONT_SHAPE); } else if (mode == "prog") { string session_name= get_env_string (PROG_SESSION); if (session_name != "default") s << "-" << session_name; s << " " << get_env_string (PROG_FONT); append_left_footer (s, PROG_FONT_FAMILY); s << " " << as_string ((int) ((base_sz+0.5)*sz)); append_left_footer (s, PROG_FONT_SERIES); append_left_footer (s, PROG_FONT_SHAPE); } string r= get_env_string (COLOR); if (r != "black") s << " " << r; if (N(s) > 0 && s[0] == " ") s= s (1, N(s)); if (inside ("session") && (lan != "scheme")) { string lan = get_env_string (PROG_LANGUAGE); string session= get_env_string (PROG_SESSION); switch (connection_status (lan, session)) { case CONNECTION_DEAD: s= s << " [dead]"; break; case CONNECTION_DYING: case WAITING_FOR_OUTPUT: s= s << " [busy]"; break; case WAITING_FOR_INPUT: s= s << " [idle]"; break; } } s= as_tree (call ("footer-hook", object (s))); set_left_footer (s); }
static int __devinit pm8xxx_led_probe(struct platform_device *pdev) { const struct pm8xxx_led_platform_data *pdata = pdev->dev.platform_data; const struct led_platform_data *pcore_data; struct led_info *curr_led; struct pm8xxx_led_data *led, *led_dat; struct pm8xxx_led_config *led_cfg; int rc, i; if (pdata == NULL) { dev_err(&pdev->dev, "platform data not supplied\n"); return -EINVAL; } pcore_data = pdata->led_core; if (pcore_data->num_leds != pdata->num_configs) { dev_err(&pdev->dev, "#no. of led configs and #no. of led" "entries are not equal\n"); return -EINVAL; } led = kcalloc(pcore_data->num_leds, sizeof(*led), GFP_KERNEL); if (led == NULL) { dev_err(&pdev->dev, "failed to alloc memory\n"); return -ENOMEM; } for (i = 0; i < pcore_data->num_leds; i++) { curr_led = &pcore_data->leds[i]; led_dat = &led[i]; led_cfg = &pdata->configs[i]; led_dat->id = led_cfg->id; led_dat->pwm_channel = led_cfg->pwm_channel; led_dat->pwm_period_us = led_cfg->pwm_period_us; led_dat->pwm_duty_cycles = led_cfg->pwm_duty_cycles; #ifdef CONFIG_MACH_MSM8960_MMI led_dat->led_ctrl = led_cfg->led_ctrl; led_dat->do_blink = 0; if (led_dat->pwm_duty_cycles == NULL) led_dat->pwm_duty_cycles = &pm8xxx_default_pwm_duty_cycles; #endif if (!((led_dat->id >= PM8XXX_ID_LED_KB_LIGHT) && (led_dat->id <= PM8XXX_ID_FLASH_LED_1))) { dev_err(&pdev->dev, "invalid LED ID (%d) specified\n", led_dat->id); rc = -EINVAL; goto fail_id_check; } led_dat->cdev.name = curr_led->name; led_dat->cdev.default_trigger = curr_led->default_trigger; led_dat->cdev.brightness_set = pm8xxx_led_set; led_dat->cdev.brightness_get = pm8xxx_led_get; #ifdef CONFIG_MACH_MSM8960_MMI led_dat->cdev.blink_set = pm8xxx_led_blink_set; #endif led_dat->cdev.brightness = LED_OFF; led_dat->cdev.flags = curr_led->flags; led_dat->dev = &pdev->dev; rc = get_init_value(led_dat, &led_dat->reg); if (rc < 0) goto fail_id_check; rc = pm8xxx_set_led_mode_and_max_brightness(led_dat, led_cfg->mode, led_cfg->max_current); if (rc < 0) goto fail_id_check; mutex_init(&led_dat->lock); INIT_WORK(&led_dat->work, pm8xxx_led_work); rc = led_classdev_register(&pdev->dev, &led_dat->cdev); if (rc) { dev_err(&pdev->dev, "unable to register led %d,rc=%d\n", led_dat->id, rc); goto fail_id_check; } if (led_cfg->mode != PM8XXX_LED_MODE_MANUAL) { __pm8xxx_led_work(led_dat, led_dat->cdev.max_brightness); if (led_dat->pwm_channel != -1) { led_dat->cdev.max_brightness = LED_FULL; rc = pm8xxx_led_pwm_configure(led_dat); if (rc) { dev_err(&pdev->dev, "failed to " "configure LED, error: %d\n", rc); goto fail_id_check; } } } else { __pm8xxx_led_work(led_dat, LED_OFF); } } platform_set_drvdata(pdev, led); return 0; fail_id_check: if (i > 0) { for (i = i - 1; i >= 0; i--) { mutex_destroy(&led[i].lock); led_classdev_unregister(&led[i].cdev); if (led[i].pwm_dev != NULL) pwm_free(led[i].pwm_dev); } } kfree(led); return rc; }
double edit_typeset_rep::get_init_double (string var) { return as_double (get_init_value (var)); }
int edit_typeset_rep::get_init_int (string var) { return as_int (get_init_value (var)); }
string edit_typeset_rep::get_init_string (string var) { return as_string (get_init_value (var)); }