Commit Graph

427 Commits

Author SHA1 Message Date
Benjamin Otte
00e84f1cdb label: Avoid deprecation warning 2012-01-06 05:23:43 +01:00
Benjamin Otte
42d0a6de23 label: Actually mark visited labels as visited
A recalculate will clear the labels and compute them again, which will
clear the information if something was visited...
2012-01-06 05:23:43 +01:00
Benjamin Otte
d6bb8a63aa label: Make attr_list_merge() use sane merging rules
Instead of "attribute with later start index wins, make sure the
attribute list that is merged from takes precedence. This now gives the
multiple attribute lists we use in the label an order:

1) gtk_label_set_attributes()
  These attributes override everything. It's what the function's there
  for after all.
2) markup of label
  Other user-specified attributes come next.
3) attributes for links
  When we apply custom attributes on parts of the text, we put them
  last. We don't want to mess with what the user does. Also, we change
  color and underline, so we usually have something to show.
2012-01-06 05:23:42 +01:00
Benjamin Otte
e78e4d8dd8 label: Rename variable
The effective attributes aren't that anymore. They're now just the
attributes from the parsed markup.
2012-01-06 05:23:42 +01:00
Benjamin Otte
f1c9a3e633 label: Don't excessively recalculate
We don't merge attributes anymore, so no need to call the function that
used to do this job.
2012-01-06 05:23:42 +01:00
Benjamin Otte
396b177e3b label: Redo attribute application
- Don't compute link color attributes until layout creation
This is useful as a performance enhancement, because we don't have to
lookup the property after setting the text, so multiple markup sets
don't cost style lookups.
- Don't merge attrs into effective_attrs
We do this when applying link colors now. Keeping them separate allows
invalidating them separately.
2012-01-06 05:23:42 +01:00
Benjamin Otte
15ac572822 ilabel: Redo gtk_label_get_link_colors()
Don't pass out an allocated color, assign it instead. Gets rid of having
to call gdk_color_free() all the time.
2012-01-06 05:23:42 +01:00
Benjamin Otte
dd4df24382 label: Split out function that merges attr lists 2012-01-06 05:23:42 +01:00
Benjamin Otte
712d577531 label: Redo links parsing
Instead of getting confused by applied underline or color tags in the
regular markup, we store the link start/end when we actually parse the
text. As a bonus, we can avoid rescanning links when creating the
markup.
2012-01-06 05:23:42 +01:00
Benjamin Otte
18ce0b21a0 label: Move function into only caller 2012-01-06 05:23:42 +01:00
Javier Jardón
d005b01319 gtk/*: Use g_list_free_full() convenience function 2012-01-05 04:22:43 +01:00
Rui Matos
5b4cc2f0b6 label: Use the widget state flags as a base for drawing 2011-12-19 19:21:16 +00:00
Rui Matos
02dd7df653 label: Stop setting state flags on the style context for drawing 2011-12-19 19:21:16 +00:00
Benjamin Otte
c3cccf586c label: Clear layout on state change
Selected or active text might be rendered differently.
2011-12-05 18:27:05 +01:00
Benjamin Otte
5ac6950dd6 label: Move callback to new stuff
We want to react to state flags changing, not to the (deprecated) state
type changing.
2011-12-05 18:27:05 +01:00
Paolo Borelli
2ef5844bac Introduce gtk_render_insertion_cursor
The new function provides an API that takes the PangoLayout and index
as input params, this way it handles strong and weak cursors internally
factoring out all code duplicated in the widgets that need to render
cursors.

https://bugzilla.gnome.org/show_bug.cgi?id=640317
2011-12-01 01:22:39 +01:00
Paolo Borelli
f18bbdff53 Remove draw_insertion_cursor in label and entry
Remove the the draw_insertion_cursor wrapper which just converts from
GtkTextDir to PangoDirection

https://bugzilla.gnome.org/show_bug.cgi?id=640317
2011-12-01 01:22:38 +01:00
Paolo Borelli
58d247d7ae Avoid shadowing a variable
Move bg_color variable to an inner scope.
2011-11-29 21:28:30 +01:00
Benjamin Otte
b526375e8f gtk: Fix compiler warnings from include fixes 2011-11-16 04:31:06 +01:00
Rico Tzschichholz
4a43c062ac Fix some implicit declaration warnings
There were some includes of gtkmain.h missing
2011-11-11 13:06:56 +01:00
Michael Natterer
5c4f2ef0c1 gtk: move _gtk_modules_has_mixed_deps() to gtkmodlesprivate.h
and remove gtkmainprivate.h completely.
2011-10-23 13:57:07 +02:00
Javier Jardón
0853ce3077 Use G_VALUE_INIT
Instead of an explicit { 0, } when declaring the variable.
2011-10-15 16:45:16 +01:00
Michael Natterer
2d3db3421f Bug 659406 - Abstract what triggers a context menu
Add gdk_event_triggers_context_menu(), using the new modifier
abstraction API. Remove _gtk_button_event_triggers_context_menu()
and port all callers.
2011-09-27 15:45:18 +02:00
Michael Natterer
b663f3a00b Bug 659406 - Abstract what triggers a context menu
Add _gtk_button_event_triggers_context_menu() and use it instead
of checking for event->button == 3, so context menus are invoked
correctly on the Mac.
2011-09-26 16:01:50 +02:00
Matthias Clasen
dc898e3f84 GtkLabel: make patterns work a little better
When a pattern has been set, we must not throw away
the attributes that contain it.

https://bugzilla.gnome.org/show_bug.cgi?id=658111
2011-09-04 00:01:37 -04:00
Tristan Van Berkom
d7696bd25f Avoid dereferencing NULL pointer in gtk_label_drag_data_get()
It's possible the GtkLabel receives drag'n'drop related signals
if it was setup to receive them by a container or other external
code, just avoid dereferencing priv->select_info in this case.
2011-08-26 19:02:36 +02:00
Chun-wei Fan
ad73ed298d Include C89 fallback code
gtk/gtkborderimage.c, gtk/gtklabel.c and gtk/gtkstyleproperty.c call
round() and/or rint(), which was only available in C99 compilers.

This adds the inclusion of the fallback implementation (gtk/fallback-c89.c)
to define these functions if they are not initially made available by the
compiler.

Also remove the rint() implementation in gtk/gtklabel.c as it is now in
the fallback implmentation.
2011-08-20 11:17:44 +08:00
Matthias Clasen
2ba9c4b4a7 Make focus rectangles optional
This commit introduces a new setting, gtk-visible-focus, backed
by the Gtk/VisibleFocus X setting. Its three values control how
focus rectangles are displayed.

'always' is equivalent to the traditional GTK+ behaviour of always
rendering focus rectangles.

'never' does what it says, and is intended for keyboardless
situations, e.g. tablets.

'automatic' hides focus rectangles initially, until the user
interacts with the keyboard, at which point focus rectangles
become visible.

https://bugzilla.gnome.org/show_bug.cgi?id=649567
2011-08-10 16:34:20 +02:00
Javier Jardon
ad0c0b8eb3 Do not initialize the priv pointer before check type 2011-07-06 14:25:06 +01:00
Matthias Clasen
3e84cc9b17 GtkLabel: optimize away some ::notify emissions 2011-07-05 16:08:09 -04:00
Matthias Clasen
c2d1e3eeb0 Avoid warnings in clipboard code
The a11y selection tests poke the selection on unrealized
labels. Don't spew warnings in this case.
2011-07-05 16:08:08 -04:00
Matthias Clasen
889b2714d5 GtkLabel: factor out two getters
Make the get_property switch look a little nicer.
We export these functions privately for use in the label
accessible implementation later on.
2011-07-05 16:08:07 -04:00
Matthias Clasen
dddf587aec GtkLabel: freeze property notification where appropriate
When setting properties that require recalculating the label
text, freeze notification until the label is properly updated.
This fixes bug 126797.
2011-07-05 16:08:06 -04:00
Matthias Clasen
a381fd288c GailLabel -> GtkLabelAccessible
A first experimental conversion from the gail namespace to gtkaccessible.
At the same time, use gtk_widget_class_set_accessible_type() to register
the accessible type for GtkLabel.
2011-07-05 16:08:06 -04:00
Javier Jardón
bf0d8402f5 gtk: Use const instead G_CONST_RETURN 2011-06-10 13:07:54 +01:00
Matthias Clasen
1371a86fb1 GtkLabel: Make selection behave more similar to GtkEntry
For shift-clicks inside the selection, shrink the selection.
https://bugzilla.gnome.org/show_bug.cgi?id=353712
2011-06-01 01:08:13 -04:00
Javier Jardón
fb9e4c2c37 all: avoid boxed structs copying where possible (and 2)
Use the GtkStyleContext accessors for boxed properties where possible,
to reduce allocations.
2011-05-31 19:18:11 +02:00
Benjamin Otte
03fbb1f34f label: Account for y-translation when rotating 2011-05-22 05:56:11 +02:00
Cosimo Cecchi
c8a59a6f92 all: avoid boxed structs copying where possible
Use the GtkStyleContext accessors for boxed properties where possible,
to reduce allocations.

https://bugzilla.gnome.org/show_bug.cgi?id=650420
2011-05-18 10:27:21 -04:00
Benjamin Otte
33e6479554 label: Compute label offset properly for wrapped justified labels
label offsets were computed wrong for wrapped or ellipsized labels that
were right- or center-justified and had excess space available.
2011-05-05 17:33:44 +02:00
Benjamin Otte
69300df1fc label: Allow using more underline modes 2011-05-03 15:38:43 +02:00
Benjamin Otte
187f91eb90 label: Don't crash when a builder file contains unknown attributes 2011-04-27 00:43:16 +02:00
Benjamin Otte
bf41392861 label: Fix an invariant leading to required > minimum 2011-04-22 02:51:52 +02:00
Benjamin Otte
9bd206a65c label: No need to special case single-line mode
It's already taken care of by the layout.
2011-04-19 22:18:18 +02:00
Benjamin Otte
38676ef718 label: Request more natural size for ellipsizing wrapping labels 2011-04-19 22:18:18 +02:00
Benjamin Otte
484e04aed2 label: Pass the desired height to measuring layout
We always pass -1 for now.
2011-04-19 22:18:18 +02:00
Benjamin Otte
403815f96f label: Remove wrap width leftovers
They're not used anymore, so we can just delete all of this code.
2011-04-19 22:18:18 +02:00
Benjamin Otte
2ecab7b90d label: Set the height of the label when ellipsized or wrapped
Obviously, we want to set it to the label's allocated height.

Also simplifies the size allocation code.
2011-04-19 22:18:18 +02:00
Benjamin Otte
5cb260075e label: Don't use a rectangle variable if we don't use a rectangle 2011-04-19 22:18:18 +02:00
Benjamin Otte
26b2f3127a label: Redo size computation
This gets use closer to the label sizing discussed on the mailing lists.
2011-04-19 22:18:18 +02:00