glom r1475 - in trunk: . glom/layout_item_dialogs glom/mode_data glom/utility_widgets



Author: jhs
Date: Thu Mar 27 21:18:35 2008
New Revision: 1475
URL: http://svn.gnome.org/viewvc/glom?rev=1475&view=rev

Log:
2008-03-27  Johannes Schmid  <jhs gnome org>

	* glom/layout_item_dialogs/dialog_textobject.cc:
	* glom/layout_item_dialogs/dialog_textobject.h:
	Added get_textobject(reference)
	
	* glom/mode_data/flowtablewithfields.cc:
	* glom/utility_widgets/labelglom.cc:
	* glom/utility_widgets/labelglom.h:
	Use the correct dialog for editing textobject (missed that one before...)

Modified:
   trunk/ChangeLog
   trunk/glom/layout_item_dialogs/dialog_textobject.cc
   trunk/glom/layout_item_dialogs/dialog_textobject.h
   trunk/glom/mode_data/flowtablewithfields.cc
   trunk/glom/utility_widgets/labelglom.cc
   trunk/glom/utility_widgets/labelglom.h

Modified: trunk/glom/layout_item_dialogs/dialog_textobject.cc
==============================================================================
--- trunk/glom/layout_item_dialogs/dialog_textobject.cc	(original)
+++ trunk/glom/layout_item_dialogs/dialog_textobject.cc	Thu Mar 27 21:18:35 2008
@@ -74,12 +74,17 @@
 {
   sharedptr<LayoutItem_Text> result = glom_sharedptr_clone(m_textobject); //Start with the old details, to preserve anything that is not in our UI.
 
-  result->set_title(m_entry_title->get_text());
-  result->set_text( m_text_view->get_buffer()->get_text() );
+  get_textobject(result);
 
   return result;
 }
 
+void Dialog_TextObject::get_textobject(sharedptr<LayoutItem_Text>& textobject) const
+{
+  textobject->set_title(m_entry_title->get_text());
+  textobject->set_text( m_text_view->get_buffer()->get_text() );
+}
+
 } //namespace Glom
 
 

Modified: trunk/glom/layout_item_dialogs/dialog_textobject.h
==============================================================================
--- trunk/glom/layout_item_dialogs/dialog_textobject.h	(original)
+++ trunk/glom/layout_item_dialogs/dialog_textobject.h	Thu Mar 27 21:18:35 2008
@@ -40,6 +40,7 @@
 
   void set_textobject(const sharedptr<const LayoutItem_Text>& textobject, const Glib::ustring& table_name, bool show_title = true);
   sharedptr<LayoutItem_Text> get_textobject() const;
+  void get_textobject(sharedptr<LayoutItem_Text>& textobject) const;
 
 protected:
   Gtk::HBox* m_box_title;

Modified: trunk/glom/mode_data/flowtablewithfields.cc
==============================================================================
--- trunk/glom/mode_data/flowtablewithfields.cc	(original)
+++ trunk/glom/mode_data/flowtablewithfields.cc	Thu Mar 27 21:18:35 2008
@@ -542,7 +542,7 @@
     alignment_title->set(Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
     alignment_title->show();
 
-    LabelGlom* title_label = Gtk::manage(new LabelGlom(title, 0, 0, false, true));
+    LabelGlom* title_label = Gtk::manage(new LabelGlom(title, 0, 0, false));
     title_label->set_layout_item (layoutitem_text, table_name);
     title_label->show();
     alignment_title->add(*title_label);
@@ -1195,7 +1195,8 @@
 {
   // create the text label
   sharedptr<LayoutItem_Text> textobject = sharedptr<LayoutItem_Text>::create();
-  textobject->set_title(_("Text Title")); //Give the button a default title, so it is big enough, and so people see that they should change it.
+  textobject->set_title(_("Title")); //Give the button a default title, so it is big enough, and so people see that they should change it.
+  textobject->set_text(_("Text"));
   sharedptr<LayoutItem> layout_item = sharedptr<LayoutItem>::cast_dynamic(textobject);
 
   dnd_add_to_layout_group (layout_item, above);

Modified: trunk/glom/utility_widgets/labelglom.cc
==============================================================================
--- trunk/glom/utility_widgets/labelglom.cc	(original)
+++ trunk/glom/utility_widgets/labelglom.cc	Thu Mar 27 21:18:35 2008
@@ -22,7 +22,8 @@
 #include <gtkmm/messagedialog.h>
 #include "../application.h"
 #include <glibmm/i18n.h>
-#include "dialog_layoutitem_properties.h"
+#include "../layout_item_dialogs/dialog_textobject.h"
+#include "../libglom/glade_utils.h"
 //#include <sstream> //For stringstream
 
 namespace Glom
@@ -37,9 +38,8 @@
   init();
 }
 
-LabelGlom::LabelGlom(const Glib::ustring& label, float xalign, float yalign, bool mnemonic, bool title)
-: m_label(label, xalign, yalign, mnemonic),
-  m_title(title)
+LabelGlom::LabelGlom(const Glib::ustring& label, float xalign, float yalign, bool mnemonic)
+: m_label(label, xalign, yalign, mnemonic)
 {
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   setup_menu();
@@ -70,36 +70,28 @@
 
 void LabelGlom::on_menu_properties_activate()
 {
+  sharedptr<LayoutItem_Text> textobject = sharedptr<LayoutItem_Text>::cast_dynamic(m_pLayoutItem);
+  if (!textobject)
+    return;
   try
   {
-    Glib::RefPtr<Gnome::Glade::Xml> refXml = Gnome::Glade::Xml::create(GLOM_GLADEDIR "glom_developer.glade", "dialog_layoutitem_properties");
-    
-    Dialog_LayoutItem_Properties* dialog = new Dialog_LayoutItem_Properties (0, refXml);
-    refXml->get_widget_derived("dialog_layoutitem_properties", dialog);
-    
-    if (dialog)
+    Glib::RefPtr<Gnome::Glade::Xml> refXml = Gnome::Glade::Xml::create(Utils::get_glade_file_path("glom_developer.glade"), "window_textobject");
+
+    Dialog_TextObject* dialog = 0;
+    refXml->get_widget_derived("window_textobject", dialog);
+
+    if(dialog)
     {
-      dialog->set_label (m_label.get_label());
-      if (dialog->run() == Gtk::RESPONSE_APPLY)
+      dialog->set_textobject(textobject, m_table_name);
+      const int response = dialog->run();
+      dialog->hide();
+      if(response == Gtk::RESPONSE_OK)
       {
-        Glib::ustring label(dialog->get_label());
-        sharedptr<LayoutItem_Text> layoutitem_text = sharedptr<LayoutItem_Text>::cast_dynamic(m_pLayoutItem);
-        if (layoutitem_text)
-        {
-          // We could just set the title of the layout item but than
-          // we would need to redraw the whole layout.
-          m_label.set_label (label);
-          if (m_title)
-          {
-            std::cout << "label: " << label << std::endl;
-            layoutitem_text->set_title (label);
-          }
-          else
-          {
-            layoutitem_text->set_text (label);
-          }
-        }
+        //Get the chosen relationship:
+        dialog->get_textobject(textobject);
       }
+      signal_layout_changed().emit();
+
       delete dialog;
     }
   }

Modified: trunk/glom/utility_widgets/labelglom.h
==============================================================================
--- trunk/glom/utility_widgets/labelglom.h	(original)
+++ trunk/glom/utility_widgets/labelglom.h	Thu Mar 27 21:18:35 2008
@@ -39,7 +39,7 @@
 {
 public:
   explicit LabelGlom();
-  explicit LabelGlom(const Glib::ustring& label, float xalign, float yalign, bool mnemonic = false, bool title = false);
+  explicit LabelGlom(const Glib::ustring& label, float xalign, float yalign, bool mnemonic = false);
   virtual ~LabelGlom();
 
 protected:
@@ -48,7 +48,6 @@
   virtual App_Glom* get_application();
     
   Gtk::Label m_label;
-  bool m_title;
     
   virtual bool on_button_press_event(GdkEventButton *event);
   virtual void on_menu_properties_activate();



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