Very good and long waited feature!! But I used to use ctrl for this kind of selection. How about others?
Daniel Juyung Seo (SeoZ) On Fri, Feb 15, 2013 at 6:44 AM, Enlightenment SVN < no-re...@enlightenment.org> wrote: > Log: > add box selection by pressing shift while selecting text. > > Patch from Panagiotis Galatsanos aka Godfath3r. > > Author: billiob > Date: 2013-02-14 13:44:16 -0800 (Thu, 14 Feb 2013) > New Revision: 83926 > Trac: http://trac.enlightenment.org/e/changeset/83926 > > Modified: > trunk/terminology/AUTHORS trunk/terminology/src/bin/termio.c > > Modified: trunk/terminology/AUTHORS > =================================================================== > --- trunk/terminology/AUTHORS 2013-02-14 21:21:05 UTC (rev 83925) > +++ trunk/terminology/AUTHORS 2013-02-14 21:44:16 UTC (rev 83926) > @@ -14,4 +14,4 @@ > Samuel F. Baggen <thanatermesis.el...@gmail.com> > Rafael Antognolli <antogno...@profusion.mobi> > Jerome Pinot <ngc...@gmail.com> > - > +Panagiotis Galatsanos <galatsan...@gmail.com> > > Modified: trunk/terminology/src/bin/termio.c > =================================================================== > --- trunk/terminology/src/bin/termio.c 2013-02-14 21:21:05 UTC (rev 83925) > +++ trunk/terminology/src/bin/termio.c 2013-02-14 21:44:16 UTC (rev 83926) > @@ -75,6 +75,7 @@ > Eina_Bool didclick : 1; > Eina_Bool bottom_right : 1; > Eina_Bool top_left : 1; > + Eina_Bool boxsel : 1; > }; > > static Evas_Smart *_smart = NULL; > @@ -395,6 +396,11 @@ > return EINA_FALSE; > } > > +#define INT_SWAP(_a, _b) do { \ > + int _swap = _a; _a = _b; _b = _swap; \ > +} while (0) > + > + > static void > _smart_apply(Evas_Object *obj) > { > @@ -542,15 +548,13 @@ > > if (cells[j].att.inverse ^ inv) > { > - int t; > - > fgext = 0; > bgext = 0; > fg = cells[j].att.fg; > bg = cells[j].att.bg; > if (fg == COL_DEF) fg = COL_INVERSEBG; > if (bg == COL_DEF) bg = COL_INVERSE; > - t = bg; bg = fg; fg = t; > + INT_SWAP(bg, fg); > if (bold) > { > fg += 12; > @@ -655,39 +659,56 @@ > if (sd->cur.sel) > { > int start_x, start_y, end_x, end_y; > - int size_top, size_bottom; > + int size_top, size_bottom; > > start_x = sd->cur.sel1.x; > start_y = sd->cur.sel1.y; > end_x = sd->cur.sel2.x; > end_y = sd->cur.sel2.y; > - if ((start_y > end_y) || ((start_y == end_y) && (end_x < > start_x))) > + > + if (sd->boxsel) > { > - int t; > + if (start_y > end_y) > + INT_SWAP(start_y, end_y); > + if (start_x > end_x) > + INT_SWAP(start_x, end_x); > + } > + else > + { > + if ((start_y > end_y) || > + ((start_y == end_y) && (end_x < start_x))) > + { > + INT_SWAP(start_y, end_y); > + INT_SWAP(start_x, end_x); > > - t = start_x; start_x = end_x; end_x = t; > - t = start_y; start_y = end_y; end_y = t; > + if (sd->top_left) > + { > + sd->top_left = EINA_FALSE; > + sd->bottom_right = EINA_TRUE; > + edje_object_signal_emit(sd->cur.selo_theme, > + "mouse,out", > + "zone.top_left"); > + edje_object_signal_emit(sd->cur.selo_theme, > + "mouse,in", > + "zone.bottom_right"); > + } > + else if (sd->bottom_right) > + { > + sd->top_left = EINA_TRUE; > + sd->bottom_right = EINA_FALSE; > + edje_object_signal_emit(sd->cur.selo_theme, > + "mouse,out", > + "zone.bottom_right"); > + edje_object_signal_emit(sd->cur.selo_theme, > + "mouse,in", > + "zone.top_left"); > + } > + } > + } > + size_top = start_x * sd->font.chw; > > - if (sd->top_left) > - { > - sd->top_left = EINA_FALSE; > - sd->bottom_right = EINA_TRUE; > - edje_object_signal_emit(sd->cur.selo_theme, > "mouse,out", "zone.top_left"); > - edje_object_signal_emit(sd->cur.selo_theme, "mouse,in", > "zone.bottom_right"); > - } > - else if (sd->bottom_right) > - { > - sd->top_left = EINA_TRUE; > - sd->bottom_right = EINA_FALSE; > - edje_object_signal_emit(sd->cur.selo_theme, > "mouse,out", "zone.bottom_right"); > - edje_object_signal_emit(sd->cur.selo_theme, "mouse,in", > "zone.top_left"); > - } > - } > + size_bottom = (sd->grid.w - end_x - 1) * sd->font.chw; > > - size_top = start_x * sd->font.chw; > - > - size_bottom = (sd->grid.w - end_x - 1) * sd->font.chw; > - > evas_object_size_hint_min_set(sd->cur.selo_top, > size_top, > sd->font.chh); > @@ -706,23 +727,42 @@ > evas_object_resize(sd->cur.selo_theme, > sd->grid.w * sd->font.chw, > (end_y + 1 - start_y) * sd->font.chh); > - if ((start_y == end_y) || > - ((start_x == 0) && (end_x == (sd->grid.w - 1)))) > - edje_object_signal_emit(sd->cur.selo_theme, > + > + if (sd->boxsel) > + { > + edje_object_signal_emit(sd->cur.selo_theme, > "mode,oneline", "terminology"); > - else if ((start_y == (end_y - 1)) && > - (start_x > end_x)) > - edje_object_signal_emit(sd->cur.selo_theme, > - "mode,disjoint", "terminology"); > - else if (start_x == 0) > - edje_object_signal_emit(sd->cur.selo_theme, > - "mode,topfull", "terminology"); > - else if (end_x == (sd->grid.w - 1)) > - edje_object_signal_emit(sd->cur.selo_theme, > - "mode,bottomfull", "terminology"); > + } > else > - edje_object_signal_emit(sd->cur.selo_theme, > - "mode,multiline", "terminology"); > + { > + if ((start_y == end_y) || > + ((start_x == 0) && (end_x == (sd->grid.w - 1)))) > + { > + edje_object_signal_emit(sd->cur.selo_theme, > + "mode,oneline", "terminology"); > + } > + else if ((start_y == (end_y - 1)) && > + (start_x > end_x)) > + { > + edje_object_signal_emit(sd->cur.selo_theme, > + "mode,disjoint", "terminology"); > + } > + else if (start_x == 0) > + { > + edje_object_signal_emit(sd->cur.selo_theme, > + "mode,topfull", "terminology"); > + } > + else if (end_x == (sd->grid.w - 1)) > + { > + edje_object_signal_emit(sd->cur.selo_theme, > + "mode,bottomfull", > "terminology"); > + } > + else > + { > + edje_object_signal_emit(sd->cur.selo_theme, > + "mode,multiline", > "terminology"); > + } > + } > evas_object_show(sd->cur.selo_theme); > } > else > @@ -825,14 +865,42 @@ > start_y = sd->cur.sel1.y; > end_x = sd->cur.sel2.x; > end_y = sd->cur.sel2.y; > - if ((start_y > end_y) || ((start_y == end_y) && (end_x < start_x))) > + > + > + if (sd->boxsel) > { > - int t; > + int i; > + Eina_Strbuf *sb; > > - t = start_x; start_x = end_x; end_x = t; > - t = start_y; start_y = end_y; end_y = t; > + if (start_y > end_y) > + INT_SWAP(start_y, end_y); > + if (start_x > end_x) > + INT_SWAP(start_x, end_x); > + > + sb = eina_strbuf_new(); > + for (i = start_y; i <= end_y; i++) > + { > + char *tmp = termio_selection_get(obj, start_x, i, end_x, i); > + size_t len = strlen(tmp); > + > + eina_strbuf_append_length(sb, tmp, len); > + if (len && tmp[len - 1] != '\n') > + eina_strbuf_append_char(sb, '\n'); > + free(tmp); > + } > + s = eina_strbuf_string_steal(sb); > + eina_strbuf_free(sb); > } > - s = termio_selection_get(obj, start_x, start_y, end_x, end_y); > + else > + { > + if ((start_y > end_y) || ((start_y == end_y) && (end_x < > start_x))) > + { > + INT_SWAP(start_y, end_y); > + INT_SWAP(start_x, end_x); > + } > + s = termio_selection_get(obj, start_x, start_y, end_x, end_y); > + } > + > if (s) > { > if (sd->win) > @@ -1844,6 +1912,7 @@ > if (!sd) return; > _smart_xy_to_cursor(data, ev->canvas.x, ev->canvas.y, &cx, &cy); > sd->didclick = EINA_FALSE; > + sd->boxsel = EINA_FALSE; > if ((ev->button == 3) && evas_key_modifier_is_set(ev->modifiers, > "Control")) > { > evas_object_smart_callback_call(data, "options", NULL); > @@ -1881,6 +1950,19 @@ > } > else > { > + if (evas_key_modifier_is_set(ev->modifiers, "Shift")) > + { > + sd->cur.sel1.x = cx; > + sd->cur.sel1.y = cy - sd->scroll; > + sd->cur.sel2.x = cx; > + sd->cur.sel2.y = cy - sd->scroll; > + sd->cur.sel = EINA_TRUE; > + sd->cur.makesel = EINA_TRUE; > + sd->boxsel = EINA_TRUE; > +#if defined(SUPPORT_DBLWIDTH) > + _selection_dbl_fix(data); > +#endif > + } > if (sd->top_left || sd->bottom_right) > { > sd->cur.makesel = 1; > @@ -1964,9 +2046,19 @@ > #if defined(SUPPORT_DBLWIDTH) > _selection_dbl_fix(data); > #endif > - _selection_newline_extend_fix(data); > - _smart_update_queue(data, sd); > - _take_selection(data, ELM_SEL_TYPE_PRIMARY); > + if (sd->boxsel) > + { > + sd->cur.sel2.x = cx; > + sd->cur.sel2.y = cy - sd->scroll; > + _smart_update_queue(data, sd); > + _take_selection(data, ELM_SEL_TYPE_PRIMARY); > + } > + else > + { > + _selection_newline_extend_fix(data); > + _smart_update_queue(data, sd); > + _take_selection(data, ELM_SEL_TYPE_PRIMARY); > + } > } > } > } > @@ -2006,8 +2098,9 @@ > #if defined(SUPPORT_DBLWIDTH) > _selection_dbl_fix(data); > #endif > - _selection_newline_extend_fix(data); > - _smart_update_queue(data, sd); > + if (!sd->boxsel) > + _selection_newline_extend_fix(data); > + _smart_update_queue(data, sd); > } > if (mc_change) > { > > > > ------------------------------------------------------------------------------ > Free Next-Gen Firewall Hardware Offer > Buy your Sophos next-gen firewall before the end March 2013 > and get the hardware for free! Learn more. > http://p.sf.net/sfu/sophos-d2d-feb > _______________________________________________ > enlightenment-svn mailing list > enlightenment-...@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn > ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel