[glom] Choices: Do not offer editing formatting features when choosign extra fields.



commit c85b8df6251541dcd8a1173a7e81103e8419b048
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Oct 7 12:28:17 2010 +0200

    Choices: Do not offer editing formatting features when choosign extra fields.
    
    * glom/mode_design/layout/layout_item_dialogs/box_formatting.[h|cc]:
      Rename the two set_formatting() methods to set_formatting_for_non_field(),
      without the show_choices option and set_formatting_for_field(). This avoids
      using the wrong one at the wrong time.
      set_is_for_print_layout(): Rename to set_is_for_non_editable() and change
      the implementation to make it more generic.
    * glom/base_db.[h|cc]: offer_field_formatting(): Rename one overload to
      offer_non_field_item_formatting() and add a show_editable_options parameter
      to the field one.
    * glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.[h|cc]:
      set_field(): Added a show_editable_options bool parameter. Hide the editable
      checkbox and tell Box_Formatting not to show editing options.
    
    * glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.[h|cc]:
    * glom/mode_design/layout/layout_item_dialogs/dialog_formatting.[h|cc]:
    * glom/mode_design/layout/layout_item_dialogs/dialog_group_by.cc:
    * glom/mode_design/print_layouts/dialog_text_formatting.[h|cc]:
    * glom/mode_design/report_layout/dialog_layout_report.cc:
    * glom/mode_design/fields/dialog_fielddefinition.cc:
    * glom/mode_design/layout/dialog_layout_details.cc:
    * glom/print_layout/canvas_print_layout.cc: Adapted.

 ChangeLog                                          |   26 ++++++++++++++++++++
 glom/base_db.cc                                    |   11 ++++----
 glom/base_db.h                                     |    4 +-
 glom/mode_design/fields/dialog_fielddefinition.cc  |    6 ++--
 glom/mode_design/layout/dialog_layout_details.cc   |    4 +-
 .../layout/layout_item_dialogs/box_formatting.cc   |   18 +++++++------
 .../layout/layout_item_dialogs/box_formatting.h    |   14 ++++++----
 .../layout_item_dialogs/dialog_field_layout.cc     |   11 +++++---
 .../layout_item_dialogs/dialog_field_layout.h      |    4 +-
 .../layout_item_dialogs/dialog_fieldslist.cc       |    2 +-
 .../layout/layout_item_dialogs/dialog_fieldslist.h |    4 +++
 .../layout_item_dialogs/dialog_formatting.cc       |    6 +---
 .../layout/layout_item_dialogs/dialog_formatting.h |    7 ++++-
 .../layout/layout_item_dialogs/dialog_group_by.cc  |    2 +-
 .../print_layouts/dialog_text_formatting.cc        |    2 +-
 .../print_layouts/dialog_text_formatting.h         |    3 +-
 .../report_layout/dialog_layout_report.cc          |    2 +-
 glom/print_layout/canvas_print_layout.cc           |   13 +++++++---
 18 files changed, 91 insertions(+), 48 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 54df8fc..c43ce9c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2010-10-07  Murray Cumming  <murrayc murrayc com>
+
+	Choices: Do not offer editing formatting features when choosign extra fields.
+
+	* glom/mode_design/layout/layout_item_dialogs/box_formatting.[h|cc]:
+  Rename the two set_formatting() methods to set_formatting_for_non_field(),
+  without the show_choices option and set_formatting_for_field(). This avoids
+  using the wrong one at the wrong time.
+  set_is_for_print_layout(): Rename to set_is_for_non_editable() and change
+  the implementation to make it more generic.
+	* glom/base_db.[h|cc]: offer_field_formatting(): Rename one overload to
+  offer_non_field_item_formatting() and add a show_editable_options parameter
+  to the field one.
+	* glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.[h|cc]:
+  set_field(): Added a show_editable_options bool parameter. Hide the editable
+  checkbox and tell Box_Formatting not to show editing options.
+
+	* glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.[h|cc]:
+	* glom/mode_design/layout/layout_item_dialogs/dialog_formatting.[h|cc]:
+	* glom/mode_design/layout/layout_item_dialogs/dialog_group_by.cc:
+	* glom/mode_design/print_layouts/dialog_text_formatting.[h|cc]:
+	* glom/mode_design/report_layout/dialog_layout_report.cc:
+	* glom/mode_design/fields/dialog_fielddefinition.cc:
+	* glom/mode_design/layout/dialog_layout_details.cc:
+	* glom/print_layout/canvas_print_layout.cc: Adapted.
+
 2010-10-06  Murray Cumming  <murrayc murrayc com>
 
 	Avoid SQL errors about invalid ORDER BY fields.
diff --git a/glom/base_db.cc b/glom/base_db.cc
index 73c7601..924ac1a 100644
--- a/glom/base_db.cc
+++ b/glom/base_db.cc
@@ -473,7 +473,7 @@ Base_DB::type_list_field_items Base_DB::offer_field_list(const Glib::ustring& ta
   return result;
 }
 
-bool Base_DB::offer_item_formatting(const sharedptr<LayoutItem_WithFormatting>& layout_item, Gtk::Window* transient_for)
+bool Base_DB::offer_non_field_item_formatting(const sharedptr<LayoutItem_WithFormatting>& layout_item, Gtk::Window* transient_for)
 {
   bool result = false;
 
@@ -483,7 +483,7 @@ bool Base_DB::offer_item_formatting(const sharedptr<LayoutItem_WithFormatting>&
 
   add_view(&dialog);
 
-  dialog.set_item(layout_item);
+  dialog.set_item(layout_item, false);
 
   const int response = dialog.run();
   if(response == Gtk::RESPONSE_OK)
@@ -499,7 +499,7 @@ bool Base_DB::offer_item_formatting(const sharedptr<LayoutItem_WithFormatting>&
   return result;
 }
 
-sharedptr<LayoutItem_Field> Base_DB::offer_field_formatting(const sharedptr<const LayoutItem_Field>& start_field, const Glib::ustring& table_name, Gtk::Window* transient_for)
+sharedptr<LayoutItem_Field> Base_DB::offer_field_formatting(const sharedptr<const LayoutItem_Field>& start_field, const Glib::ustring& table_name, Gtk::Window* transient_for, bool show_editable_options)
 {
   sharedptr<LayoutItem_Field> result;
 
@@ -507,14 +507,13 @@ sharedptr<LayoutItem_Field> Base_DB::offer_field_formatting(const sharedptr<cons
   Utils::get_glade_widget_derived_with_warning(dialog);
   if(!dialog) //Unlikely and it already warns on stderr.
     return result;
-  
+
   if(transient_for)
     dialog->set_transient_for(*transient_for);
 
   add_view(dialog);
 
-  dialog->set_field(start_field, table_name);
-
+  dialog->set_field(start_field, table_name, show_editable_options);
 
   const int response = dialog->run();
   if(response == Gtk::RESPONSE_OK)
diff --git a/glom/base_db.h b/glom/base_db.h
index e11f018..79e3873 100644
--- a/glom/base_db.h
+++ b/glom/base_db.h
@@ -109,12 +109,12 @@ protected:
   type_list_field_items offer_field_list(const Glib::ustring& table_name, Gtk::Window* transient_for = 0);
 
 
-  sharedptr<LayoutItem_Field> offer_field_formatting(const sharedptr<const LayoutItem_Field>& start_field, const Glib::ustring& table_name, Gtk::Window* transient_for = 0);
+  sharedptr<LayoutItem_Field> offer_field_formatting(const sharedptr<const LayoutItem_Field>& start_field, const Glib::ustring& table_name, Gtk::Window* transient_for, bool show_editable_options = true);
 
   /** Offer generic formatting for a @a layout_item, starting with its current options.
    * @result true if the user changed some formatting for the items.
    */
-  bool offer_item_formatting(const sharedptr<LayoutItem_WithFormatting>& layout_item, Gtk::Window* transient_for = 0);
+  bool offer_non_field_item_formatting(const sharedptr<LayoutItem_WithFormatting>& layout_item, Gtk::Window* transient_for = 0);
 
   sharedptr<LayoutItem_Text> offer_textobject(const sharedptr<LayoutItem_Text>& start_textobject, Gtk::Window* transient_for = 0, bool show_title = true);
   sharedptr<LayoutItem_Image> offer_imageobject(const sharedptr<LayoutItem_Image>& start_imageobject, Gtk::Window* transient_for = 0, bool show_title = true);
diff --git a/glom/mode_design/fields/dialog_fielddefinition.cc b/glom/mode_design/fields/dialog_fielddefinition.cc
index 273c9ff..40b3ea7 100644
--- a/glom/mode_design/fields/dialog_fielddefinition.cc
+++ b/glom/mode_design/fields/dialog_fielddefinition.cc
@@ -88,7 +88,7 @@ Dialog_FieldDefinition::Dialog_FieldDefinition(BaseObjectType* cobject, const Gl
 
   //Get the formatting stuff:
   Utils::get_glade_widget_derived_with_warning(m_box_formatting);
-    
+
   if(m_box_formatting) ////Unlikely to fail and it already warns on stderr.
     m_box_formatting_placeholder->pack_start(*m_box_formatting);
 
@@ -98,7 +98,7 @@ Dialog_FieldDefinition::Dialog_FieldDefinition(BaseObjectType* cobject, const Gl
   on_foreach_connect(*this);
   on_foreach_connect(*m_pBox_DefaultValueSimple);
   on_foreach_connect(*m_pBox_ValueTab);
-  
+
   if(m_box_formatting) ////Unlikely to fail and it already warns on stderr.
     on_foreach_connect(*m_box_formatting);
 
@@ -215,7 +215,7 @@ void Dialog_FieldDefinition::set_field(const sharedptr<const Field>& field, cons
   m_pEntry_Title->set_text(field->get_title());
 
   //Formatting:
-  m_box_formatting->set_formatting(field->m_default_formatting, m_table_name, field);
+  m_box_formatting->set_formatting_for_field(field->m_default_formatting, m_table_name, field);
 
   set_blocked(false);
 
diff --git a/glom/mode_design/layout/dialog_layout_details.cc b/glom/mode_design/layout/dialog_layout_details.cc
index 6f767d7..572eca8 100644
--- a/glom/mode_design/layout/dialog_layout_details.cc
+++ b/glom/mode_design/layout/dialog_layout_details.cc
@@ -555,7 +555,7 @@ sharedptr<LayoutItem_Button> Dialog_Layout_Details::offer_button_script_edit(con
   Glom::Utils::get_glade_widget_derived_with_warning(dialog);
   if(!dialog) //Unlikely and it already warns on stderr.
     return result;
-        
+
   dialog->set_script(button, m_table_name);
   dialog->set_transient_for(*this);
   const int response = Glom::Utils::dialog_run_with_help(dialog);
@@ -906,7 +906,7 @@ void Dialog_Layout_Details::on_button_formatting()
         sharedptr<LayoutItem_WithFormatting> withformatting = sharedptr<LayoutItem_WithFormatting>::cast_dynamic(layout_item);
         if(withformatting)
         {
-          const bool changed = offer_item_formatting(withformatting, this);
+          const bool changed = offer_non_field_item_formatting(withformatting, this);
           if(changed)
             m_modified = true;
         }
diff --git a/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc b/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
index 04cfc0a..11ce36f 100644
--- a/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/box_formatting.cc
@@ -69,7 +69,7 @@ Box_Formatting::Box_Formatting(BaseObjectType* cobject, const Glib::RefPtr<Gtk::
   m_dialog_choices_extra_fields(0),
   m_for_print_layout(false),
   m_show_numeric(true),
-  m_show_choices(true)
+  m_show_editable_options(true)
 {
   //Numeric formatting:
   builder->get_widget("vbox_numeric_format", m_vbox_numeric_format);
@@ -171,10 +171,10 @@ Box_Formatting::~Box_Formatting()
   }
 }
 
-void Box_Formatting::set_is_for_print_layout()
+void Box_Formatting::set_is_for_non_editable()
 {
   m_for_print_layout = true;
-  m_show_choices = false;
+  m_show_editable_options = false;
 
   //Add labels (because we will hide the checkboxes):
   Gtk::Label* label = Gtk::manage(new Gtk::Label(_("Font")));
@@ -190,21 +190,23 @@ void Box_Formatting::set_is_for_print_layout()
   enforce_constraints();
 }
 
-void Box_Formatting::set_formatting(const FieldFormatting& format, const Glib::ustring& table_name, const sharedptr<const Field>& field)
+void Box_Formatting::set_formatting_for_field(const FieldFormatting& format, const Glib::ustring& table_name, const sharedptr<const Field>& field)
 {
   //Used for choices and some extra text formatting:
   m_table_name = table_name;
   m_field = field;
 
-  set_formatting(format);
+  set_formatting_for_non_field(format,
+    true /* show_numeric, ignoring anyway when m_field is set */);
 }
 
-void Box_Formatting::set_formatting(const FieldFormatting& format, bool show_numeric, bool show_choices)
+void Box_Formatting::set_formatting_for_non_field(const FieldFormatting& format, bool show_numeric)
 {
+  //TODO: Split this into a private method, so that previously-set m_table_name and m_field (from set_formatting_for_field()) will not stay set.
+
   m_format = format;
 
   m_show_numeric = show_numeric;
-  m_show_choices = show_choices;
 
   //Numeric formatting:
   m_checkbox_format_use_thousands->set_active( format.m_numeric_format.m_use_thousands_separator );
@@ -488,7 +490,7 @@ void Box_Formatting::enforce_constraints()
   else
     m_vbox_numeric_format->hide();
 
-  if(m_show_choices)
+  if(m_field && m_show_editable_options)
     m_vbox_choices->show();
   else
     m_vbox_choices->hide();
diff --git a/glom/mode_design/layout/layout_item_dialogs/box_formatting.h b/glom/mode_design/layout/layout_item_dialogs/box_formatting.h
index fce9016..364d716 100644
--- a/glom/mode_design/layout/layout_item_dialogs/box_formatting.h
+++ b/glom/mode_design/layout/layout_item_dialogs/box_formatting.h
@@ -49,19 +49,21 @@ public:
   /**
    * @param format The starting information.
    */
-  void set_formatting(const FieldFormatting& format, bool show_numeric = true, bool show_choices = true);
+  void set_formatting_for_non_field(const FieldFormatting& format, bool show_numeric = true);
 
   /**
    * @param format The starting information.
    * @param table_name The field's table.
    * @param The field that will have this formatting, so we know what formatting options to allow.
    */
-  void set_formatting(const FieldFormatting& format, const Glib::ustring& table_name, const sharedptr<const Field>& field);
+  void set_formatting_for_field(const FieldFormatting& format, const Glib::ustring& table_name, const sharedptr<const Field>& field);
   bool get_formatting(FieldFormatting& format) const;
 
-  //When used for print layout items,
-  //we hide some stuff:
-  void set_is_for_print_layout();
+  /** When used, for instance, for print layout items or choice lists,
+   * where the user could not edit the field anyway.
+   * This hides some UI.
+   */
+  void set_is_for_non_editable();
 
   typedef sigc::signal<void> type_signal_modified;
   type_signal_modified signal_modified();
@@ -121,7 +123,7 @@ private:
   bool m_for_print_layout;
 
   bool m_show_numeric;
-  bool m_show_choices;
+  bool m_show_editable_options;
 
   type_signal_modified m_signal_modified;
 
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.cc b/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.cc
index 5d4dd35..d7a80ad 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.cc
@@ -68,7 +68,7 @@ Dialog_FieldLayout::~Dialog_FieldLayout()
   remove_view(m_box_formatting);
 }
 
-void Dialog_FieldLayout::set_field(const sharedptr<const LayoutItem_Field>& field, const Glib::ustring& table_name)
+void Dialog_FieldLayout::set_field(const sharedptr<const LayoutItem_Field>& field, const Glib::ustring& table_name, bool show_editable_options)
 {
   m_layout_item = glom_sharedptr_clone(field);
 
@@ -83,6 +83,9 @@ void Dialog_FieldLayout::set_field(const sharedptr<const LayoutItem_Field>& fiel
   const bool editable_allowed = field_details && !field_details->get_has_calculation();
   m_checkbutton_editable->set_sensitive(editable_allowed);
 
+  if(!show_editable_options)
+    m_checkbutton_editable->hide();
+
   //Custom title:
   Glib::ustring title_custom;
   if(field->get_title_custom())
@@ -94,7 +97,9 @@ void Dialog_FieldLayout::set_field(const sharedptr<const LayoutItem_Field>& fiel
 
   //Formatting:
   m_radiobutton_custom_formatting->set_active( !field->get_formatting_use_default() );
-  m_box_formatting->set_formatting(field->m_formatting, table_name, field->get_full_field_details());
+  m_box_formatting->set_formatting_for_field(field->m_formatting, table_name, field->get_full_field_details());
+  if(!show_editable_options)
+    m_box_formatting->set_is_for_non_editable();
 
   enforce_constraints();
 }
@@ -128,5 +133,3 @@ void Dialog_FieldLayout::enforce_constraints()
 }
 
 } //namespace Glom
-
-
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.h b/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.h
index 95daf8d..9e650f0 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.h
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_field_layout.h
@@ -39,7 +39,7 @@ class Dialog_FieldLayout
 public:
   static const char* glade_id;
   static const bool glade_developer;
-  
+
   Dialog_FieldLayout(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
   virtual ~Dialog_FieldLayout();
 
@@ -48,7 +48,7 @@ public:
    * @param field The starting field information.
    * @param table_name The field's table.
    */
-  virtual void set_field(const sharedptr<const LayoutItem_Field>& field, const Glib::ustring& table_name);
+  virtual void set_field(const sharedptr<const LayoutItem_Field>& field, const Glib::ustring& table_name, bool show_editable_options = true);
 
   sharedptr<LayoutItem_Field> get_field_chosen() const;
 
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc b/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc
index 88ce1e0..dee2ae9 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.cc
@@ -363,7 +363,7 @@ void Dialog_FieldsList::on_button_formatting()
       sharedptr<const LayoutItem_Field> field = row[m_ColumnsFields.m_col_layout_item];
       if(field)
       {
-        field = offer_field_formatting(field, m_table_name, this);
+        field = offer_field_formatting(field, m_table_name, this, false /* no editing options */);
         row[m_ColumnsFields.m_col_layout_item] = field;
       }
     }
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.h b/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.h
index c927017..ff7cc91 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.h
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_fieldslist.h
@@ -28,6 +28,10 @@
 namespace Glom
 {
 
+/** This dialog allows the user to specify a list of non-editable fields,
+ * with field formatting.
+ * For instance, for related choice lists, or for sort criteria.
+ */
 class Dialog_FieldsList
  : public Dialog_Layout //It has some useful stuff
 {
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_formatting.cc b/glom/mode_design/layout/layout_item_dialogs/dialog_formatting.cc
index 2941e60..8173714 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_formatting.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_formatting.cc
@@ -49,9 +49,9 @@ Dialog_Formatting::~Dialog_Formatting()
   remove_view(m_box_formatting);
 }
 
-void Dialog_Formatting::set_item(const sharedptr<const LayoutItem_WithFormatting>& layout_item)
+void Dialog_Formatting::set_item(const sharedptr<const LayoutItem_WithFormatting>& layout_item, bool show_numeric)
 {
-  m_box_formatting->set_formatting(layout_item->m_formatting, false, false);
+  m_box_formatting->set_formatting_for_non_field(layout_item->m_formatting, show_numeric);
 
   enforce_constraints();
 }
@@ -69,5 +69,3 @@ void Dialog_Formatting::enforce_constraints()
 }
 
 } //namespace Glom
-
-
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_formatting.h b/glom/mode_design/layout/layout_item_dialogs/dialog_formatting.h
index 75d375a..aee9194 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_formatting.h
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_formatting.h
@@ -32,6 +32,9 @@
 namespace Glom
 {
 
+/** This dialog lets the user choose the formatting for non-field items.
+ * Field items should use Dialog_FieldLayout instead.
+ */
 class Dialog_Formatting
  : public Gtk::Dialog,
    public View_Composite_Glom //Give it access to the document.
@@ -44,9 +47,9 @@ public:
    * @param document The document, so that the dialog can load the previous layout, and save changes.
    * @param field The starting item information.
    */
-  void set_item(const sharedptr<const LayoutItem_WithFormatting>& field);
+  void set_item(const sharedptr<const LayoutItem_WithFormatting>& field, bool show_numeric);
 
-  /** Set the @a layout_item's formatting to the formatting specified in the 
+  /** Set the @a layout_item's formatting to the formatting specified in the
    * dialog by the user.
    */
   void use_item_chosen(const sharedptr<LayoutItem_WithFormatting>& layout_item);
diff --git a/glom/mode_design/layout/layout_item_dialogs/dialog_group_by.cc b/glom/mode_design/layout/layout_item_dialogs/dialog_group_by.cc
index a81de44..33ee9c9 100644
--- a/glom/mode_design/layout/layout_item_dialogs/dialog_group_by.cc
+++ b/glom/mode_design/layout/layout_item_dialogs/dialog_group_by.cc
@@ -120,7 +120,7 @@ void Dialog_GroupBy::on_button_formatting_group_by()
 {
   if(m_layout_item)
   {
-    sharedptr<LayoutItem_Field> field = offer_field_formatting(m_layout_item->get_field_group_by(), m_table_name, this);
+    sharedptr<LayoutItem_Field> field = offer_field_formatting(m_layout_item->get_field_group_by(), m_table_name, this, false /* no editing options. */);
     if(field)
     {
       m_layout_item->set_field_group_by(field);
diff --git a/glom/mode_design/print_layouts/dialog_text_formatting.cc b/glom/mode_design/print_layouts/dialog_text_formatting.cc
index 57b5a4e..4ed8816 100644
--- a/glom/mode_design/print_layouts/dialog_text_formatting.cc
+++ b/glom/mode_design/print_layouts/dialog_text_formatting.cc
@@ -45,7 +45,7 @@ Dialog_TextFormatting::Dialog_TextFormatting(BaseObjectType* cobject, const Glib
   Utils::get_glade_widget_derived_with_warning(m_box_formatting);
   m_box_formatting_placeholder->pack_start(*m_box_formatting);
   add_view(m_box_formatting);
-  m_box_formatting->set_is_for_print_layout();
+  m_box_formatting->set_is_for_non_editable();
 
   set_modal(); //We don't want people to edit the main window while we are changing structure.
 
diff --git a/glom/mode_design/print_layouts/dialog_text_formatting.h b/glom/mode_design/print_layouts/dialog_text_formatting.h
index 2a79e5e..86220bb 100644
--- a/glom/mode_design/print_layouts/dialog_text_formatting.h
+++ b/glom/mode_design/print_layouts/dialog_text_formatting.h
@@ -29,6 +29,7 @@
 namespace Glom
 {
 
+//TODO: Rename this? It seems to be only used for Print Layouts. Or why not use Dialog_Formatting instead?
 /** A dialog with a titled frame, a label for the table title, and a close button.
  */
 class Dialog_TextFormatting
@@ -42,7 +43,7 @@ public:
   Dialog_TextFormatting(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder);
   virtual ~Dialog_TextFormatting();
 
-  //Allow direct access, for convenience:  
+  //Allow direct access, for convenience:
   Gtk::VBox* m_box_formatting_placeholder;
   Box_Formatting* m_box_formatting;
 
diff --git a/glom/mode_design/report_layout/dialog_layout_report.cc b/glom/mode_design/report_layout/dialog_layout_report.cc
index d2c0f09..a69ef19 100644
--- a/glom/mode_design/report_layout/dialog_layout_report.cc
+++ b/glom/mode_design/report_layout/dialog_layout_report.cc
@@ -790,7 +790,7 @@ void Dialog_Layout_Report::on_button_formatting()
       sharedptr<LayoutItem_Field> field = sharedptr<LayoutItem_Field>::cast_dynamic(item);
       if(field)
       {
-        sharedptr<LayoutItem_Field> field_chosen = offer_field_formatting(field, m_table_name, this);
+        sharedptr<LayoutItem_Field> field_chosen = offer_field_formatting(field, m_table_name, this, false /* no editing options */);
         if(field_chosen)
         {
           *field = *field_chosen;
diff --git a/glom/print_layout/canvas_print_layout.cc b/glom/print_layout/canvas_print_layout.cc
index dac3411..ae656df 100644
--- a/glom/print_layout/canvas_print_layout.cc
+++ b/glom/print_layout/canvas_print_layout.cc
@@ -387,13 +387,18 @@ void Canvas_PrintLayout::on_context_menu_formatting()
 
   //We need an if here, because they have no common base class.
   //TODO: Maybe they should.
-  FieldFormatting formatting;
   if(layout_item_field)
-    formatting = layout_item_field->m_formatting;
+  {
+    const FieldFormatting& formatting = layout_item_field->m_formatting;
+    m_dialog_format->m_box_formatting->set_formatting_for_field(formatting, m_table_name, layout_item_field->get_full_field_details());
+  }
   else
-    formatting = layout_item_text->m_formatting;
+  {
+    const FieldFormatting& formatting = layout_item_text->m_formatting;
+    m_dialog_format->m_box_formatting->set_formatting_for_non_field(formatting);
+  }
 
-  m_dialog_format->m_box_formatting->set_formatting(formatting);
+  m_dialog_format->m_box_formatting->set_is_for_non_editable();
 
   m_dialog_format->show();
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]