[Commits] [wesnoth/wesnoth] e3e4ac: add left click handler to labels

GitHub noreply at github.com
Sun Oct 19 01:11:47 UTC 2014


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: e3e4ac7fb752d34c8a901832ec2623ef0812143e
      https://github.com/wesnoth/wesnoth/commit/e3e4ac7fb752d34c8a901832ec2623ef0812143e
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-10-18 (Sat, 18 Oct 2014)

  Changed paths:
    M src/gui/widgets/label.cpp
    M src/gui/widgets/label.hpp

  Log Message:
  -----------
  add left click handler to labels


  Commit: b4f559dad090eb1228587b307b1deed104281880
      https://github.com/wesnoth/wesnoth/commit/b4f559dad090eb1228587b307b1deed104281880
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-10-18 (Sat, 18 Oct 2014)

  Changed paths:
    M src/text.cpp
    M src/text.hpp

  Log Message:
  -----------
  add to font::ttext an interface to pango fcn xy_to_index

This is used implicitly in the "get_column_line" function but
sometimes you just want the index, for instance, if you want to
resolve whether a link was clicked on.


  Commit: 31b56814ec337778df8f4529876dfc31d2df7ba9
      https://github.com/wesnoth/wesnoth/commit/31b56814ec337778df8f4529876dfc31d2df7ba9
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-10-18 (Sat, 18 Oct 2014)

  Changed paths:
    M src/gui/widgets/control.cpp
    M src/gui/widgets/control.hpp
    M src/gui/widgets/label.cpp

  Log Message:
  -----------
  get text index for a text label when it is clicked on


  Commit: 1dd26fb696a5cbf4ff04d4aef4b223ebdfef465a
      https://github.com/wesnoth/wesnoth/commit/1dd26fb696a5cbf4ff04d4aef4b223ebdfef465a
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-10-18 (Sat, 18 Oct 2014)

  Changed paths:
    M src/gui/widgets/control.cpp
    M src/gui/widgets/control.hpp
    M src/gui/widgets/label.cpp
    M src/text.cpp
    M src/text.hpp

  Log Message:
  -----------
  replace "get_string_index" with "get_token"

The get_token function, for a font::ttext, takes a coordinate
position and a list of delimiter characters, and returns the token
pointed to, if the position is in bounds, and the character being
pointed at is not itself a delimiter. Otherwise it returns the
empty string.

We also add some debugging output to the label click handler,
so that on log channel gui/event, we can see example tokens and
whether they look like URLs.


  Commit: 676db81cd9ad72e70fbae4c817cfa963a4ee2651
      https://github.com/wesnoth/wesnoth/commit/676db81cd9ad72e70fbae4c817cfa963a4ee2651
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-10-18 (Sat, 18 Oct 2014)

  Changed paths:
    M src/gui/widgets/label.cpp

  Log Message:
  -----------
  add support to open clicked links, after prompting user

If the user clicks on a token in a gui2 label that looks like a
link, prompt them if they want to open it.


  Commit: 854688b3977c8c048799497064c9314075c5b768
      https://github.com/wesnoth/wesnoth/commit/854688b3977c8c048799497064c9314075c5b768
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-10-18 (Sat, 18 Oct 2014)

  Changed paths:
    M src/text.cpp
    M src/text.hpp

  Log Message:
  -----------
  add "link awareness" to font::ttext objects

If link awareness is enabled, then tokens that look like links
will be rendered thusly, and a "get_link" function is provided
to check if a layout location is pointing to a token which was
rendered as a link.


  Commit: ad8e1f7763ab3ebcdbf1ff101f4cf41f26ea81e1
      https://github.com/wesnoth/wesnoth/commit/ad8e1f7763ab3ebcdbf1ff101f4cf41f26ea81e1
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-10-18 (Sat, 18 Oct 2014)

  Changed paths:
    M data/gui/default/widget/label_default.cfg
    M data/gui/schema.cfg
    M src/gui/auxiliary/canvas.cpp
    M src/gui/widgets/control.cpp
    M src/gui/widgets/control.hpp
    M src/gui/widgets/label.cpp

  Log Message:
  -----------
  link-aware rendering of labels

This commit adds a new property of font::ttext, whether it is
"link aware". Link aware text has tokens that look like hyperlinks
formatted thusly, with coloration and an underline.

A `get_link` function, taking a layout location, returns a link
token if it is pointed to at that location, and link awareness
is enabled, and the empty string otherwise.

All gui2::tcontrols may now have their text labels set to be link
aware if desired. The gui2::tlabel constructor automatically sets
these to be link aware. The gui2::tlabel click handler is set to
use the `get_link` function instead of the `get_token` function.

Link awareness is also registered as a property of [text] fields in
gui widget definitions.


  Commit: 25c359302dc37f1e72d29bff347f44a2b0422b14
      https://github.com/wesnoth/wesnoth/commit/25c359302dc37f1e72d29bff347f44a2b0422b14
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-10-18 (Sat, 18 Oct 2014)

  Changed paths:
    M src/gui/widgets/label.cpp

  Log Message:
  -----------
  if opening links is not supported, tell the user so when they try


  Commit: c18a23ed8f4c46c2b5440b14b911aea42e3d9a85
      https://github.com/wesnoth/wesnoth/commit/c18a23ed8f4c46c2b5440b14b911aea42e3d9a85
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-10-18 (Sat, 18 Oct 2014)

  Changed paths:
    M src/gui/widgets/label.cpp
    M src/gui/widgets/label.hpp

  Log Message:
  -----------
  add right click handler for links in labels, copies to clipboard

Pretty much the same as left click otherwise


  Commit: 3ccb0b027434de354d42d2983cef9912ce0aea41
      https://github.com/wesnoth/wesnoth/commit/3ccb0b027434de354d42d2983cef9912ce0aea41
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-10-18 (Sat, 18 Oct 2014)

  Changed paths:
    M src/gui/widgets/control.cpp
    M src/gui/widgets/control.hpp
    M src/gui/widgets/label.cpp
    M src/gui/widgets/label.hpp

  Log Message:
  -----------
  move link_aware from being a property of controls to prop of labels

tcontrol now gets it by a virtual method, whose default impl is
false, and is only overrided in label.

This refactor cleans things up, since link aware is really only
relevant to the click handler of label.


  Commit: de1c04e1870b9bc93983dd008025593bac8c4fd3
      https://github.com/wesnoth/wesnoth/commit/de1c04e1870b9bc93983dd008025593bac8c4fd3
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-10-18 (Sat, 18 Oct 2014)

  Changed paths:
    M data/gui/default/widget/label_default.cfg
    M data/gui/schema.cfg
    M src/gui/auxiliary/widget_definition/label.cpp
    M src/gui/auxiliary/widget_definition/label.hpp
    M src/gui/widgets/label.cpp
    M src/gui/widgets/label.hpp

  Log Message:
  -----------
  make labels read "link_aware" property from their widget defn

This adds a "link_aware" key to label definitions, and C++ tlabel
objects no longer initializer this to true, but instead read the
value from their definition configuration.


  Commit: 5f3dbe1d98b79bb5ae3812e5202df07dbc6e7da7
      https://github.com/wesnoth/wesnoth/commit/5f3dbe1d98b79bb5ae3812e5202df07dbc6e7da7
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-10-18 (Sat, 18 Oct 2014)

  Changed paths:
    M data/gui/default/widget/label_default.cfg
    M data/gui/schema.cfg
    M src/gui/auxiliary/canvas.cpp
    M src/gui/auxiliary/widget_definition/label.cpp
    M src/gui/auxiliary/widget_definition/label.hpp
    M src/gui/widgets/control.cpp
    M src/gui/widgets/control.hpp
    M src/gui/widgets/label.cpp
    M src/gui/widgets/label.hpp
    M src/text.cpp
    M src/text.hpp

  Log Message:
  -----------
  add link_color property of label defn, passed to font::ttext

This commit permits link_color to be specified in any label defn,
at the same place that link_aware is specified. It will be passed
through to tcanvas and finally font::ttext in a similar manner as
link awareness, and used for the color parameter in any link
formatting. We choose a default value of #ffff00 everywhere,
matching the definition currently in the help browser for cross-
references.


  Commit: ace04ab9ffd0c971a2be1196fc559bbad343da9f
      https://github.com/wesnoth/wesnoth/commit/ace04ab9ffd0c971a2be1196fc559bbad343da9f
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-10-18 (Sat, 18 Oct 2014)

  Changed paths:
    M src/gui/widgets/control.cpp
    M src/gui/widgets/control.hpp

  Log Message:
  -----------
  move default values of link aware, color out of tcontrol header


  Commit: 536c20076b35185fc3fe41b404f21cbe5324db9f
      https://github.com/wesnoth/wesnoth/commit/536c20076b35185fc3fe41b404f21cbe5324db9f
  Author: Chris Beck <render787 at gmail.com>
  Date:   2014-10-18 (Sat, 18 Oct 2014)

  Changed paths:
    M src/gui/auxiliary/widget_definition/label.cpp

  Log Message:
  -----------
  fixup some comments on label definition args


  Commit: 455f6f72094c1c7b62e29dda975eab3d6dbf4f87
      https://github.com/wesnoth/wesnoth/commit/455f6f72094c1c7b62e29dda975eab3d6dbf4f87
  Author: Chris Beck <beck.ct at gmail.com>
  Date:   2014-10-18 (Sat, 18 Oct 2014)

  Changed paths:
    M data/gui/default/widget/label_default.cfg
    M data/gui/schema.cfg
    M src/gui/auxiliary/canvas.cpp
    M src/gui/auxiliary/widget_definition/label.cpp
    M src/gui/auxiliary/widget_definition/label.hpp
    M src/gui/widgets/control.cpp
    M src/gui/widgets/control.hpp
    M src/gui/widgets/label.cpp
    M src/gui/widgets/label.hpp
    M src/text.cpp
    M src/text.hpp

  Log Message:
  -----------
  Merge pull request #300 from cbeck88/clickable_labels

Clickable hyperlinks in gui2 labels


Compare: https://github.com/wesnoth/wesnoth/compare/007da9fef473...455f6f72094c


More information about the Commits mailing list