glom r1554 - in trunk: . glom glom/mode_data glom/utility_widgets



Author: jhs
Date: Fri Apr 11 12:02:24 2008
New Revision: 1554
URL: http://svn.gnome.org/viewvc/glom?rev=1554&view=rev

Log:
2008-04-11  Johannes Schmid <johannes schmid openismus com>

	* glom/application.cc 
	(update_userlevel_ui):
	* glom/application.h:
	* glom/mode_data/box_data_details.cc
	  (create_layout):
	* glom/mode_data/box_data_details.h
	Moved sidebar into \"Details\"-page
	 
	* glom/utility_widgets/sidebar.cc 
	  (on_child_detached),(on_child_attached):
	* glom/utility_widgets/sidebar.h:
	Made sidebar detachable again and give it a correct size when detached

Modified:
   trunk/ChangeLog
   trunk/glom/application.cc
   trunk/glom/application.h
   trunk/glom/mode_data/box_data_details.cc
   trunk/glom/mode_data/box_data_details.h
   trunk/glom/utility_widgets/sidebar.cc
   trunk/glom/utility_widgets/sidebar.h

Modified: trunk/glom/application.cc
==============================================================================
--- trunk/glom/application.cc	(original)
+++ trunk/glom/application.cc	Fri Apr 11 12:02:24 2008
@@ -101,11 +101,9 @@
 #endif
   type_base(cobject, "Glom"),
   m_pBoxTop(0),
-  m_pBoxSidebar(0),
   m_pFrame(0),
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   m_window_translations(0),
-  m_pDrag_Bar(0),
 #endif // !GLOM_ENABLE_CLIENT_ONLY
   m_menu_tables_ui_merge_id(0),
   m_menu_reports_ui_merge_id(0),
@@ -1140,25 +1138,12 @@
   {
     if(!m_action_menu_userlevel_developer->get_active())
       m_action_menu_userlevel_developer->set_active();
-    // Show the drag layout toolbar
-    if (!m_pDrag_Bar)
-    {
-      m_pDrag_Bar = new DragBar();
-      App_Glom::get_application ()->add_sidebar (*m_pDrag_Bar);
-      m_pDrag_Bar->show();
-    }
   }
   else if(userlevel ==  AppState::USERLEVEL_OPERATOR)
   {
     if(!m_action_menu_userlevel_operator->get_active())
       m_action_menu_userlevel_operator->set_active();
     // Remove the drag layout toolbar
-    if (m_pDrag_Bar)
-    {
-      App_Glom::get_application ()->remove_sidebar (*m_pDrag_Bar);
-      delete m_pDrag_Bar;
-      m_pDrag_Bar = 0;
-    }
   }
 }
 #endif // !GLOM_ENABLE_CLIENT_ONLY
@@ -2346,16 +2331,6 @@
 }
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
-void App_Glom::add_sidebar(SideBar& sidebar)
-{
-  m_pBoxSidebar->pack_start (sidebar);
-}
-
-void App_Glom::remove_sidebar(SideBar& sidebar)
-{
-  m_pBoxSidebar->remove (sidebar);
-}
-
 #ifndef GLOM_ENABLE_CLIENT_ONLY
 Document_Glom* App_Glom::on_connection_pool_get_document()
 {

Modified: trunk/glom/application.h
==============================================================================
--- trunk/glom/application.h	(original)
+++ trunk/glom/application.h	Fri Apr 11 12:02:24 2008
@@ -23,7 +23,6 @@
 
 #include "bakery/bakery.h"
 #include "frame_glom.h"
-#include "utility_widgets/sidebar.h"
 
 #include "config.h" // For GLOM_ENABLE_CLIENT_ONLY
 
@@ -82,9 +81,6 @@
   ///Whether to show the generated SQL queries on stdout, for debugging.
   void set_show_sql_debug(bool val = true);
 
-  void add_sidebar(SideBar& sidebar);
-  void remove_sidebar(SideBar& sidebar);
-
   static App_Glom* get_application();
 	
 protected:
@@ -160,8 +156,6 @@
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   Window_Translations* m_window_translations;
 
-  // Drag bar (to be replaced by the fancy selector widget from mathias)
-  DragBar* m_pDrag_Bar;
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
   Glib::RefPtr<Gtk::ActionGroup> m_refNavTablesActionGroup, m_refNavReportsActionGroup, m_refNavPrintLayoutsActionGroup;

Modified: trunk/glom/mode_data/box_data_details.cc
==============================================================================
--- trunk/glom/mode_data/box_data_details.cc	(original)
+++ trunk/glom/mode_data/box_data_details.cc	Fri Apr 11 12:02:24 2008
@@ -38,6 +38,7 @@
 
 Box_Data_Details::Box_Data_Details(bool bWithNavButtons /* = true */)
 : m_HBox(false, Utils::DEFAULT_SPACING_SMALL),
+  m_HBox_Sidebar (false, Utils::DEFAULT_SPACING_SMALL),
   m_Button_New(Gtk::Stock::ADD),
   m_Button_Del(Gtk::Stock::DELETE),
   m_Button_Nav_First(Gtk::Stock::GOTO_FIRST),
@@ -89,7 +90,12 @@
   m_ScrolledWindow.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); /* Allow vertical scrolling, but never scroll horizontally. */
 #endif
   m_ScrolledWindow.set_shadow_type(Gtk::SHADOW_NONE); //SHADOW_IN is Recommended by the GNOME HIG, but looks odd.
-  pack_start(m_ScrolledWindow);
+
+#ifndef GLOM_ENABLE_CLIENT_ONLY
+  m_HBox_Sidebar.pack_start (m_Dragbar, Gtk::PACK_SHRINK);
+  m_Dragbar.hide();
+#endif
+  m_HBox_Sidebar.pack_start(m_ScrolledWindow);
   m_ScrolledWindow.add(m_FlowTable);
   // The FlowTable does not support native scrolling, so gtkmm adds it to a
   // viewport first that also has some shadow we do not want.
@@ -119,6 +125,7 @@
   m_Button_Nav_Next.signal_clicked().connect(sigc::mem_fun(*this, &Box_Data_Details::on_button_nav_next));
   m_Button_Nav_Last.signal_clicked().connect(sigc::mem_fun(*this, &Box_Data_Details::on_button_nav_last));
 
+  pack_start(m_HBox_Sidebar);
   pack_start(m_HBox, Gtk::PACK_SHRINK);
 
   m_FlowTable.signal_field_edited().connect( sigc::mem_fun(*this,  &Box_Data_Details::on_flowtable_field_edited) );
@@ -218,6 +225,14 @@
   }
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   m_FlowTable.set_design_mode(m_design_mode);
+  if (m_design_mode)
+  {
+    m_Dragbar.show();
+  }
+  else
+  {
+    m_Dragbar.hide();
+  }
 #endif
 }
 

Modified: trunk/glom/mode_data/box_data_details.h
==============================================================================
--- trunk/glom/mode_data/box_data_details.h	(original)
+++ trunk/glom/mode_data/box_data_details.h	Fri Apr 11 12:02:24 2008
@@ -27,6 +27,9 @@
 //#include "box_data_list_related.h"
 #include "flowtablewithfields.h"
 #include "../utility_widgets/placeholder.h"
+#ifndef GLOM_ENABLE_CLIENT_ONLY
+#include "../utility_widgets/dragbar.h"
+#endif
 
 namespace Glom
 {
@@ -114,8 +117,12 @@
   //Member widgets:
   Gtk::ScrolledWindow m_ScrolledWindow;
   Gtk::HBox m_HBox;
+  Gtk::HBox m_HBox_Sidebar;
   Gtk::Button m_Button_New;
   Gtk::Button m_Button_Del;
+#ifndef GLOM_ENABLE_CLIENT_ONLY
+  DragBar m_Dragbar;
+#endif
 
   /*
   Gtk::Frame m_Frame_Related;

Modified: trunk/glom/utility_widgets/sidebar.cc
==============================================================================
--- trunk/glom/utility_widgets/sidebar.cc	(original)
+++ trunk/glom/utility_widgets/sidebar.cc	Fri Apr 11 12:02:24 2008
@@ -19,12 +19,16 @@
  */
 
 #include "sidebar.h"
+#include <iostream>
 
 namespace Glom
 {
 
 SideBar::SideBar()
-{  
+{ 
+  set_handle_position (Gtk::POS_TOP);
+  set_snap_edge (Gtk::POS_TOP);
+  
 	palette = EGG_TOOL_PALETTE(egg_tool_palette_new ());
 	Gtk::Container* container = Glib::wrap(GTK_CONTAINER(palette));
 	
@@ -53,5 +57,17 @@
   egg_tool_palette_set_drag_source (palette);
 }
 
+void SideBar::on_child_detached(Gtk::Widget* child)
+{
+  get_size_request (m_width, m_height);
+  child->set_size_request (m_width, m_height);
+  set_size_request (0, 0);
+}
+
+void SideBar::on_child_attached(Gtk::Widget* child)
+{
+  set_size_request (m_width, m_height);
+}
+
 } // namespace Glom
 

Modified: trunk/glom/utility_widgets/sidebar.h
==============================================================================
--- trunk/glom/utility_widgets/sidebar.h	(original)
+++ trunk/glom/utility_widgets/sidebar.h	Fri Apr 11 12:02:24 2008
@@ -31,7 +31,7 @@
 namespace Glom
 {
 
-class SideBar : public Gtk::VBox
+class SideBar : public Gtk::HandleBox
 {
 public:
   SideBar();
@@ -41,9 +41,16 @@
 	void remove_group (EggToolItemGroup* group);
   
   void set_drag_source();
-  
+
+protected:
+  virtual void on_child_detached(Gtk::Widget* child);
+  virtual void on_child_attached(Gtk::Widget* child);
+    
 private:
   EggToolPalette* palette;
+    
+  int m_width;
+  int m_height;
 };
 
 } //namespace Glom



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