[niepce] Allow wrapping for TokenTextView. Fix metadata label alignment for taller widgets (like TextView)
- From: Hubert Figuière <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce] Allow wrapping for TokenTextView. Fix metadata label alignment for taller widgets (like TextView)
- Date: Sat, 12 Jul 2014 17:02:32 +0000 (UTC)
commit a2d2b8f07aee7517ceaba1d03eb365ddc5a2d59e
Author: Hubert Figuière <hub figuiere net>
Date: Fri Jul 11 22:36:10 2014 -0400
Allow wrapping for TokenTextView.
Fix metadata label alignment for taller widgets (like TextView)
src/fwk/toolkit/metadatawidget.cpp | 9 ++++++++-
src/fwk/toolkit/widgets/tokentextview.cpp | 10 ++++++++--
src/fwk/toolkit/widgets/tokentextview.hpp | 4 +++-
3 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/src/fwk/toolkit/metadatawidget.cpp b/src/fwk/toolkit/metadatawidget.cpp
index ce7fb14..c5ab1a3 100644
--- a/src/fwk/toolkit/metadatawidget.cpp
+++ b/src/fwk/toolkit/metadatawidget.cpp
@@ -152,7 +152,14 @@ MetaDataWidget::create_widgets_for_format(const MetaDataSectionFormat * fmt)
Gtk::Label *labelw = Gtk::manage(new Gtk::Label(
Glib::ustring("<b>")
+ current->label + "</b>"));
- labelw->set_alignment(0.0f, 0.5f);
+ if(current->type != META_DT_STRING_ARRAY
+ && current->type != META_DT_TEXT) {
+ labelw->set_alignment(0.0f, 0.5f);
+ }
+ else {
+ // Text can wrap. Different alignment for the label
+ labelw->set_alignment(0.0f, 0.0f);
+ }
labelw->set_use_markup(true);
switch(current->type) {
diff --git a/src/fwk/toolkit/widgets/tokentextview.cpp b/src/fwk/toolkit/widgets/tokentextview.cpp
index df4942e..f6b7b0a 100644
--- a/src/fwk/toolkit/widgets/tokentextview.cpp
+++ b/src/fwk/toolkit/widgets/tokentextview.cpp
@@ -1,7 +1,7 @@
/*
* niepce - fwk/toolkit/widgets/tokentextview.cpp
*
- * Copyright (C) 2012-2013 Hubert Figuiere
+ * Copyright (C) 2012-2014 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,9 +25,15 @@
namespace fwk {
+TokenTextView::TokenTextView()
+ : NoTabTextView()
+{
+ set_wrap_mode(Gtk::WRAP_WORD);
+}
+
void TokenTextView::set_tokens(const Tokens & tokens)
{
- std::string v = fwk::join(tokens, ",");
+ std::string v = fwk::join(tokens, ", ");
get_buffer()->set_text(v);
}
diff --git a/src/fwk/toolkit/widgets/tokentextview.hpp b/src/fwk/toolkit/widgets/tokentextview.hpp
index b2d8000..0044e42 100644
--- a/src/fwk/toolkit/widgets/tokentextview.hpp
+++ b/src/fwk/toolkit/widgets/tokentextview.hpp
@@ -1,7 +1,7 @@
/*
* niepce - fwk/toolkit/widgets/tokentextview.hpp
*
- * Copyright (C) 2012 Hubert Figuiere
+ * Copyright (C) 2012-2014 Hubert Figuiere
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,6 +31,8 @@ class TokenTextView
: public NoTabTextView
{
public:
+ TokenTextView();
+
typedef std::vector<std::string> Tokens;
void set_tokens(const Tokens & tokens);
void get_tokens(Tokens & tokens);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]