[glom/spread-table] FlowTableWithFields: Fix some widget expansion behaviour.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/spread-table] FlowTableWithFields: Fix some widget expansion behaviour.
- Date: Mon, 8 Nov 2010 14:57:35 +0000 (UTC)
commit 961a8592488dd5bf524cd6c76e21ab0b02d7393d
Author: Murray Cumming <murrayc murrayc com>
Date: Mon Nov 8 15:57:27 2010 +0100
FlowTableWithFields: Fix some widget expansion behaviour.
* glom/mode_data/datawidget/label.cc: Call Gtk::Label::set_line_wrap() to
prevent the label from sometimes making the window insanely wide by demainding
too much width for itself.
* glom/mode_data/flowtablewithfields.cc: add_field_at_position(): Tell
the field's widget to expand, so it uses more space if the user expands the
window, instead of just expanding the gap between columns.
Note that the old non-EggSpreadTable code only expanded the right-most column,
so exanding both is a real improvement.
ChangeLog | 13 +++++++++++++
glom/mode_data/datawidget/label.cc | 5 ++++-
glom/mode_data/flowtablewithfields.cc | 6 ++----
3 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 54189b0..b5c0164 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2010-11-08 Murray Cumming <murrayc murrayc com>>
+
+ FlowTableWithFields: Fix some widget expansion behaviour.
+
+ * glom/mode_data/datawidget/label.cc: Call Gtk::Label::set_line_wrap() to
+ prevent the label from sometimes making the window insanely wide by demainding
+ too much width for itself.
+ * glom/mode_data/flowtablewithfields.cc: add_field_at_position(): Tell
+ the field's widget to expand, so it uses more space if the user expands the
+ window, instead of just expanding the gap between columns.
+ Note that the old non-EggSpreadTable code only expanded the right-most column,
+ so exanding both is a real improvement.
+
2010-11-08 Murray Cumming <murrayc murrayc com>
EggSpreadTable: forall(): Avoid use of invalid GList items.
diff --git a/glom/mode_data/datawidget/label.cc b/glom/mode_data/datawidget/label.cc
index 12a14a5..17cd5d4 100644
--- a/glom/mode_data/datawidget/label.cc
+++ b/glom/mode_data/datawidget/label.cc
@@ -59,8 +59,11 @@ void Label::init()
add(m_label);
m_label.show();
set_events(Gdk::ALL_EVENTS_MASK);
- //This would be more efficient if we were only using the (base) EventBox to get events,
+ //This would be more efficient if we were only using the (base) EventBox to get events,
//but we also want to allow changing of the background color, so we don't use it: set_visible_window(false);
+
+ //Otherwise the label could demand a huge width if there is lots of text.
+ m_label.set_line_wrap();
}
Application* Label::get_application()
diff --git a/glom/mode_data/flowtablewithfields.cc b/glom/mode_data/flowtablewithfields.cc
index 869f502..3b0747a 100644
--- a/glom/mode_data/flowtablewithfields.cc
+++ b/glom/mode_data/flowtablewithfields.cc
@@ -537,10 +537,8 @@ void FlowTableWithFields::add_field_at_position(const sharedptr<LayoutItem_Field
//info.m_group = layoutitem_field.m_group;
//Expand multiline text fields to take up the maximum possible width:
- bool expand_second = false;
if( (layoutitem_field->get_glom_type() == Field::TYPE_TEXT) && layoutitem_field->get_formatting_used().get_text_format_multiline())
{
- expand_second = true;
if(label)
label->set_property("yalign", 0.0); //Equivalent to Gtk::ALIGN_START. Center is neater next to entries, but center is silly next to multi-line text boxes.
}
@@ -559,9 +557,9 @@ void FlowTableWithFields::add_field_at_position(const sharedptr<LayoutItem_Field
Gtk::Widget* widget = dynamic_cast<Gtk::Widget*>(*add_before);
if(widget)
- insert_before(*eventbox, *(info.m_second), *widget, expand_second);
+ insert_before(*eventbox, *(info.m_second), *widget, true);
else
- add(*eventbox, *(info.m_second), expand_second);
+ add(*eventbox, *(info.m_second), true);
info.m_second->signal_edited().connect( sigc::bind(sigc::mem_fun(*this, &FlowTableWithFields::on_entry_edited), layoutitem_field) ); //TODO: Is it a good idea to bind the LayoutItem? sigc::bind() probably stores a copy at this point.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]