Skip to content

Commit

Permalink
marge master
Browse files Browse the repository at this point in the history
  • Loading branch information
kisvegabor committed Mar 6, 2019
2 parents 2b4185e + 66e70af commit d9874ae
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 14 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Choose a project with your favourite IDE:
### Porting to an embedded hardware
In the most simple case you need to do these steps:
1. Copy `lv_conf_templ.h` as `lv_conf.h` next to `lvgl` and set at least `LV_HOR_RES`, `LV_VER_RES` and `LV_COLOR_DEPTH`.
2. Call `lv_tick_inc(x)` every `x` milliseconds **in a Timer or Task** (`x` should be between 1 and 10)
2. Call `lv_tick_inc(x)` every `x` milliseconds **in a Timer or Task** (`x` should be between 1 and 10). It is required for the internal timing of LittlevGL.
3. Call `lv_init()`
4. Create a buffer for LittlevGL
```c
Expand Down Expand Up @@ -126,7 +126,11 @@ bool my_touchpad_read(lv_indev_t * indev, lv_indev_data_t * data)
return false; /*Return `false` because we are not buffering and no more data to read*/
}
```
<<<<<<< HEAD
6. Call `lv_task_handler()` periodically every few milliseconds in the main `while(1)` loop, in a Timer interrupt or in an Operation system task.
=======
6. Call `lv_task_handler()` periodically every few milliseconds in the main `while(1)` loop, in Timer interrupt or in an Operation system task. It will redraw the screen if required, handle input devices etc.
>>>>>>> master
For a detailed description check the [Documentation](https://docs.littlevgl.com/#Porting) or the [Porting examples](https://github.com/littlevgl/lvgl/tree/multi-disp/lv_porting).
Expand Down Expand Up @@ -189,26 +193,24 @@ lv_btn_set_ink_out_time(btn, 300);

#### Use LittlevGL from Micropython
```python

# Create a Button and a Label

scr = lv.obj()
btn = lv.btn(scr)
btn.align(lv.scr_act(), lv.ALIGN.CENTER, 0, 0)
label = lv.label(btn)
label.set_text("Button")

# Load the screen

lv.scr_load(scr)
```

Check out the [Documentation](https://docs.littlevgl.com/) for more!

### Contributing
To ask questions and discuss topics we use [GitHub's Issue tracker](https://github.com/littlevgl/lvgl/issues).
You contribute in several ways:
- **Answer other's question** click the Watch button on the top to get notified about the issues
To ask questions please use the [Forum](https://forum.littlevgl.com).
FOr development related things (bug reports, feature suggestions) use [GitHub's Issue tracker](https://github.com/littlevgl/lvgl/issues).
You can contribute in several ways:
- **Answer other's question** in the Forum
- **Report and/or fix bugs** using the issue tracker and in Pull-request
- **Suggest and/or implement new features** using the issue tracker and in Pull-request
- **Improve and/or translate the documentation** learn more [here](https://github.com/littlevgl/docs)
Expand Down
29 changes: 29 additions & 0 deletions lv_core/lv_group.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ static void style_mod_edit_def(lv_style_t * style);
static void refresh_theme(lv_group_t * g, lv_theme_t * th);
static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *), void * (*move)(const lv_ll_t *, const void *));
static void lv_group_refocus(lv_group_t * g);
static void obj_to_foreground(lv_obj_t * obj);



/**********************
* STATIC VARIABLES
Expand Down Expand Up @@ -196,6 +199,9 @@ void lv_group_focus_obj(lv_obj_t * obj)
(*g->obj_focus)->signal_func(*g->obj_focus, LV_SIGNAL_FOCUS, NULL);
if(g->focus_cb) g->focus_cb(g);
lv_obj_invalidate(*g->obj_focus);

/*If the object or its parent has `top == true` bring it to the foregorund*/
obj_to_foreground(*g->obj_focus);
}
break;
}
Expand Down Expand Up @@ -575,9 +581,32 @@ static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *)
group->obj_focus = obj_next;

(*group->obj_focus)->signal_func(*group->obj_focus, LV_SIGNAL_FOCUS, NULL);

/*If the object or its parent has `top == true` bring it to the foregorund*/
obj_to_foreground(*group->obj_focus);

lv_obj_invalidate(*group->obj_focus);

if(group->focus_cb) group->focus_cb(group);
}

static void obj_to_foreground(lv_obj_t * obj)
{
/*Search for 'top' attribute*/
lv_obj_t * i = obj;
lv_obj_t * last_top = NULL;
while(i != NULL) {
if(i->top != 0) last_top = i;
i = lv_obj_get_parent(i);
}

if(last_top != NULL) {
/*Move the last_top object to the foreground*/
lv_obj_t * par = lv_obj_get_parent(last_top);
/*After list change it will be the new head*/
lv_ll_chg_list(&par->child_ll, &par->child_ll, last_top);
lv_obj_invalidate(last_top);
}
}

#endif /*USE_LV_GROUP != 0*/
8 changes: 8 additions & 0 deletions lv_misc/lv_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
* DEFINES
*********************/

/* "free" is used as a function pointer (in lv_fs_drv_t).
* We must make sure "free" was not defined to a platform specific
* free function, otherwise compilation would fail.
*/
#ifdef free
#undef free
#endif

/**********************
* TYPEDEFS
**********************/
Expand Down
1 change: 1 addition & 0 deletions lv_objx/lv_btnm.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, const lv_obj_t * copy)
ext->action = NULL;
ext->map_p = NULL;
ext->toggle = 0;
ext->recolor = 0;
ext->styles_btn[LV_BTN_STATE_REL] = &lv_style_btn_rel;
ext->styles_btn[LV_BTN_STATE_PR] = &lv_style_btn_pr;
ext->styles_btn[LV_BTN_STATE_TGL_REL] = &lv_style_btn_tgl_rel;
Expand Down
5 changes: 4 additions & 1 deletion lv_objx/lv_ta.c
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,7 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void

lv_obj_t * ta = lv_obj_get_parent(scrl);
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);

if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
/*Set ext. size because the cursor might be out of this object*/
lv_style_t * style_label = lv_obj_get_style(ext->label);
Expand All @@ -1213,6 +1214,9 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void
if(ext->label) {
if(lv_obj_get_width(ta) != lv_area_get_width(param) ||
lv_obj_get_height(ta) != lv_area_get_height(param)) {

lv_obj_t * scrl = lv_page_get_scrl(ta);

lv_style_t * style_scrl = lv_obj_get_style(scrl);
lv_obj_set_width(ext->label, lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.hor);
lv_obj_set_pos(ext->label, style_scrl->body.padding.hor, style_scrl->body.padding.ver);
Expand All @@ -1226,7 +1230,6 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void
update_cursor_position_on_click(ta, (lv_indev_t *)param);
}


return res;
}

Expand Down
14 changes: 8 additions & 6 deletions lv_objx/lv_tileview.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void
if(res != LV_RES_OK) return res;

lv_obj_t * tileview = lv_obj_get_parent(scrl);
lv_style_t * style_bg = lv_tileview_get_style(tileview, LV_TILEVIEW_STYLE_BG);


/*Apply constraint on moving of the tileview*/
if(sign == LV_SIGNAL_CORD_CHG) {
Expand Down Expand Up @@ -377,7 +379,7 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void
lv_page_start_edge_flash(tileview);
}

lv_obj_set_y(scrl, -ext->act_id.y * h);
lv_obj_set_y(scrl, -ext->act_id.y * h + style_bg->body.padding.ver);
}
}
if(ext->drag_bottom_en == 0 && indev->proc.types.pointer.vect.y < 0 && ext->drag_hor == 0) {
Expand All @@ -390,7 +392,7 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void
}
}

lv_obj_set_y(scrl, -ext->act_id.y * h);
lv_obj_set_y(scrl, -ext->act_id.y * h + style_bg->body.padding.ver);
}
if(ext->drag_left_en == 0) {
if(x > -(ext->act_id.x * w) && indev->proc.types.pointer.vect.x > 0 && ext->drag_ver == 0) {
Expand All @@ -401,7 +403,7 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void
lv_page_start_edge_flash(tileview);
}

lv_obj_set_x(scrl, -ext->act_id.x * w);
lv_obj_set_x(scrl, -ext->act_id.x * w + style_bg->body.padding.hor);
}
}
if(ext->drag_right_en == 0 && indev->proc.types.pointer.vect.x < 0 && ext->drag_ver == 0) {
Expand All @@ -414,12 +416,12 @@ static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void
}
}

lv_obj_set_x(scrl, -ext->act_id.x * w);
lv_obj_set_x(scrl, -ext->act_id.x * w + style_bg->body.padding.hor);
}

/*Apply the drag constraints*/
if(ext->drag_ver == 0) lv_obj_set_y(scrl, - ext->act_id.y * lv_obj_get_height(tileview));
if(ext->drag_hor == 0) lv_obj_set_x(scrl, - ext->act_id.x * lv_obj_get_width(tileview));
if(ext->drag_ver == 0) lv_obj_set_y(scrl, - ext->act_id.y * lv_obj_get_height(tileview) + style_bg->body.padding.ver);
if(ext->drag_hor == 0) lv_obj_set_x(scrl, - ext->act_id.x * lv_obj_get_width(tileview) + style_bg->body.padding.hor);
}
}

Expand Down

0 comments on commit d9874ae

Please sign in to comment.