the usual blob of fixes. note the requirement for ComboBoxText::set_active_text()
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 2 Dec 2005 19:18:26 +0000 (19:18 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 2 Dec 2005 19:18:26 +0000 (19:18 +0000)
git-svn-id: svn://localhost/trunk/ardour2@160 d708f5d6-7413-0410-9779-e7cbd77b26cf

21 files changed:
gtk2_ardour/ardour-menus.xml
gtk2_ardour/ardour_dialog.cc
gtk2_ardour/ardour_dialog.h
gtk2_ardour/ardour_message.cc
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h
gtk2_ardour/ardour_ui.rc
gtk2_ardour/automation_line.cc
gtk2_ardour/editor.cc
gtk2_ardour/editor_canvas.cc
gtk2_ardour/export_dialog.cc
gtk2_ardour/export_dialog.h
gtk2_ardour/gtkscrolledwindow.c
gtk2_ardour/main.cc
gtk2_ardour/plugin_selector.cc
gtk2_ardour/plugin_selector.h
gtk2_ardour/plugin_ui.cc
gtk2_ardour/redirect_box.cc
gtk2_ardour/utils.cc
libs/gtkmm2ext/gtk_ui.cc
libs/gtkmm2ext/gtkmm2ext/gtk_ui.h

index 28b76e358a08db9530aa5e4eeb16d385ee3e7c14..f02e4654a149055cf9ce788774a82eeee1a2fb21 100644 (file)
@@ -1,4 +1,5 @@
 <ui>
+
     <menubar name='Main' action='MainMenu'>
         <menu name='Session' action='Session'>
            <menuitem action='New'/>
                <menuitem action='ToggleBigClock'/>
         </menu>
      </menubar>
+
+     <popup name='redirectmenu'>
+        <menuitem action='newplugin'/>
+        <menuitem action='newinsert'/>
+        <menuitem action='newsend'/>
+         <separator/>
+        <menuitem action='clear'/>
+         <separator/>
+        <menuitem action='cut'/>
+        <menuitem action='copy'/>
+        <menuitem action='paste'/>
+         <separator/>
+        <menuitem action='rename'/>
+         <separator/>
+        <menuitem action='selectall'/>
+        <menuitem action='deselectall'/>
+         <separator/>
+        <menuitem action='activate'/>
+        <menuitem action='deactivate'/>
+         <separator/>
+        <menuitem action='activate_all'/>
+        <menuitem action='deactivate_all'/>
+         <separator/>
+        <menuitem action='edit'/>
+      </popup>
+
 </ui>
index 22f3f260483089ac93c917f023a0fd752218e7bd..10f6bafc6b7f1ac02bbb2ef62da7facc334b8feb 100644 (file)
@@ -26,8 +26,8 @@
 #include "ardour_ui.h"
 
 
-ArdourDialog::ArdourDialog (string title, bool modal)
-       : Dialog (title, modal)
+ArdourDialog::ArdourDialog (string title, bool modal, bool use_seperator)
+       : Dialog (title, modal, use_seperator)
 {
        session = 0;
 }
index 0b93dfb37b25b3d384c4d62fb896b2dc0b6aae4d..a23dcda9e0000d718e3903ed716fe0028623eb00 100644 (file)
@@ -36,7 +36,7 @@ namespace ARDOUR {
 class ArdourDialog : public Gtk::Dialog
 {
   public:
-       ArdourDialog (std::string title, bool modal = false);
+       ArdourDialog (std::string title, bool modal = false, bool use_separator = false);
        ~ArdourDialog();
 
        bool on_enter_notify_event (GdkEventCrossing*);
index 48cfa80caffdcdfbf5744a952aae19babebe2dc5..5f761cb6b9c0c3611c0e00cbd6e3d4d2219b28e9 100644 (file)
@@ -30,14 +30,14 @@ using namespace Gtk;
 ArdourMessage::ArdourMessage (Gtk::Window* parent, 
                              string name, string msg, 
                              bool grab_focus, bool auto_run)
-       : ArdourDialog (name)
+       : ArdourDialog (name),
+         label (msg, 0.5, 0.5)
 {
-       label.set_text (msg);
-       label.set_alignment (0.5, 0.5);
        label.set_name (X_("PrompterLabel"));
+       label.show ();
 
        get_vbox()->pack_start (label);
-
+       
        Button* ok_button = add_button (Stock::OK, RESPONSE_ACCEPT);
        
        set_name (X_("Prompter"));
index c2edada43df375d13caed8f666762cdd91e68dbb..0633e9cceba6906436f0053d3058270420528383 100644 (file)
@@ -1087,7 +1087,7 @@ If you still wish to quit, please use the\n\n\
                }
        }
 
-       quit();
+       quit ();
 }
 
 int
@@ -1100,7 +1100,7 @@ ARDOUR_UI::ask_about_saving_session (string what)
        msg = string_compose(_("Save and %1"), what);
        window.add_button (msg, RESPONSE_ACCEPT);
        msg = string_compose(_("Just %1"), what);
-       window.add_button (msg, RESPONSE_REJECT);
+       window.add_button (msg, RESPONSE_APPLY);
        msg = string_compose(_("Don't %1"), what);
        window.add_button (msg, RESPONSE_REJECT);
 
@@ -1138,7 +1138,9 @@ ARDOUR_UI::ask_about_saving_session (string what)
        window.hide ();
 
        switch (r) {
-       case RESPONSE_ACCEPT:
+       case RESPONSE_ACCEPT: // save and get out of here
+               return 1;
+       case RESPONSE_APPLY:  // get out of here
                return 0;
        default:
                break;
index d9ba85bb70e7b36d98a44ef01f4f694a21689504..3697eb7303633a68d2ff5a74f99f97d20f6abbcb 100644 (file)
@@ -99,7 +99,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
   public:
        ARDOUR_UI (int *argcp, char **argvp[], string rcfile);
        ~ARDOUR_UI();
-       
+
        void show ();
        bool shown() { return shown_flag; }
        
@@ -700,4 +700,5 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        Glib::RefPtr<Gtk::ActionGroup> common_actions;
 };
 
+
 #endif /* __ardour_gui_h__ */
index 7e2edfd19a9b2117884373fcc29d6ae656521af1..de4bb837df9d3884f1bf48b7c3795a5b2cfbb474 100644 (file)
@@ -5,32 +5,27 @@
 
 style "very_small_text"
 {
-       fontset="-*-helvetica-medium-r-normal-*-8-*-*-*-p-*-*-*"
-       font ="-*-helvetica-medium-r-normal-*-*-80-*-*-p-*-*"
+       font ="sans-8"
 }
 
 style "small_text"
 {
-       fontset="-*-helvetica-medium-r-normal-*-10-*-*-*-p-*-*-*"
-       font ="-*-helvetica-medium-r-normal-*-*-100-*-*-p-*-*"
+       font ="sans-10"
 }
 
 style "small_bold_text"
 {
-       fontset="-*-helvetica-bold-r-normal-*-10-*-*-*-p-*-*-*"
-       font ="-*-helvetica-bold-r-normal-*-*-100-*-*-p-*-*"
+       font="sans-bold-10"
 }
 
 style "medium_bold_text"
 {
-       fontset="-*-helvetica-bold-r-normal-*-12-*-*-*-p-*-*-*"
-       font ="-*-helvetica-bold-r-normal-*-*-120-*-*-p-*-*"
+       font ="sans-bold-12"
 }
 
 style "medium_text"
 {
-       fontset="-*-helvetica-medium-r-normal-*-12-*-*-*-p-*-*-*"
-       font ="-*-helvetica-medium-r-normal-*-*-120-*-*-p-*-*"
+       font="sans-12"
 }
 
 style "red_medium_text" = "medium_text"
@@ -43,52 +38,48 @@ style "red_medium_text" = "medium_text"
 
 style "large_text"
 {
-       fontset="-*-helvetica-bold-r-normal-*-18-*-*-*-p-*-*-*"
-       font ="-*-helvetica-bold-r-normal-*-*-180-*-*-p-*-*"
+       font ="sans-18"
 }
 
 style "larger_bold_text"
 {
-       fontset="-*-helvetica-bold-r-normal-*-14-*-*-*-p-*-*-*"
-       font ="-*-helvetica-bold-r-normal-*-*-140-*-*-p-*-*"
+       font ="sans-14"
 }
 
 style "plugin_name_text"
 {
-       fontset="-*-helvetica-bold-o-*-*-25-*-*-*-p-*-*-*"
-       font="-*-helvetica-bold-o-*-*-25-*-*-*-p-*-*-*"
+       font="sans-bold-25"
        fg[NORMAL] = { 0.80, 0.80, 0.70 }
 }
 
 style "plugin_maker_text"
 {
-       fontset="-*-helvetica-bold-o-*-*-14-*-*-*-p-*-*-*"
-       font="-*-helvetica-bold-o-*-*-14-*-*-*-p-*-*-*"
+       font="sans-bold-14"
        fg[NORMAL] = { 0.80, 0.80, 0.70 }
 }
 
 style "first_action_message" 
 {
-       font="-*-helvetica-medium-r-*-*-34-350-*-*-*-*-*-*"
-       fontset="-*-helvetica-medium-r-*-*-34-350-*-*-*-*-*-*"
+       font="mono-35"
+       fontset="mono-35"
 }
 
 style "verbose_canvas_cursor"
 {
-       font="-*-helvetica-medium-r-*-*-*-240-*-*-*-*-*-*"
-       fontset="-*-helvetica-medium-r-*-*-*-240-*-*-*-*-*-*"
+       font="sans-24"
+       fontset="sans-24"
 }
 
 style "marker_text" 
 {
-       font="-*-helvetica-medium-r-*-*-10-*-*-*-*-*-*-*"
-       fontset="-*-helvetica-medium-r-*-*-10-*-*-*-*-*-*-*"
+       font="sans-10"
+       fontset="sans-10"
 }
 
 style "time_axis_view_item_name"
 {
-       font="-*-helvetica-medium-r-normal-*-*-100-*-*-p-*-*-1"
-       fontset="-*-helvetica-medium-r-normal-*-*-100-*-*-p-*-*-1"
+       font="sans-10"
+       fontset="sans-10"
 }
 
 style "default_base" = "medium_text"
@@ -168,8 +159,8 @@ style "black_mackie_menu_bar" = "medium_bold_text"
 
 style "default_buttons_menus" = "default_base"
 {
-  fontset="-*-helvetica-medium-r-normal-*-12-*-*-*-p-*-*-*"
-  font ="-*-helvetica-medium-r-normal-*-*-120-*-*-p-*-*"
+  fontset="sans-12"
+  font ="sans-12"
        
   fg[ACTIVE] = { 0, 0, 0 }
   
@@ -182,14 +173,14 @@ style "default_buttons_menus" = "default_base"
 
 style "very_small_button" = "default_buttons_menus"
 {
-       fontset="-*-helvetica-medium-r-normal-*-8-*-*-*-p-*-*-*"
-       font ="-*-helvetica-medium-r-normal-*-*-80-*-*-p-*-*"
+       fontset="sans-8"
+       font ="sans-8"
 }
 
 style "small_button" = "default_buttons_menus"
 {
-       fontset="-*-helvetica-medium-r-normal-*-10-*-*-*-p-*-*-*"
-       font ="-*-helvetica-medium-r-normal-*-*-100-*-*-p-*-*"
+       fontset="sans-10"
+       font ="sans-10"
 }
 
 style "very_small_red_active_and_selected_button" = "very_small_button"
@@ -218,8 +209,8 @@ style "track_rec_enable_button" = "small_button"
 
 style "mixer_rec_enable_button" = "track_rec_enable_button"
 {
-       fontset="-*-helvetica-medium-r-normal-*-8-*-*-*-p-*-*-*"
-       font ="-*-helvetica-medium-r-normal-*-*-80-*-*-p-*-*"
+       fontset="sans-8"
+       font ="sans-8"
 }
 
 style "solo_button" = "small_button"
@@ -233,8 +224,8 @@ style "solo_button" = "small_button"
 
 style "mixer_solo_button" = "solo_button"
 {
-       fontset="-*-helvetica-medium-r-normal-*-8-*-*-*-p-*-*-*"
-       font ="-*-helvetica-medium-r-normal-*-*-80-*-*-p-*-*"
+       fontset="sans-8"
+       font ="sans-8"
 }
 
 
@@ -248,8 +239,8 @@ style "mute_button" = "small_button"
 
 style "mixer_mute_button" = "mute_button"
 {
-       fontset="-*-helvetica-medium-r-normal-*-8-*-*-*-p-*-*-*"
-       font ="-*-helvetica-medium-r-normal-*-*-80-*-*-p-*-*"
+       fontset="sans-8"
+       font ="sans-8"
 }
 
 style "track_loop_button" = "small_button"
@@ -270,8 +261,8 @@ style "mixer_red_active_button" = "very_small_button"
 
 style "time_button" = "default_buttons_menus"
 {
-       fontset="-*-helvetica-medium-r-normal-*-8-*-*-*-p-*-*-*"
-       font ="-*-helvetica-medium-r-normal-*-*-80-*-*-p-*-*"
+       fontset="sans-8"
+       font ="sans-8"
 }
 
 style "transport_button" = "very_small_button"
@@ -316,8 +307,8 @@ style "ardour_progressbars" = "default_buttons_menus"
 
 style "options_window"  = "default_base"
 {
-       fontset="-*-helvetica-bold-r-normal-*-12-*-*-*-p-*-*-*"
-       font ="-*-helvetica-bold-r-normal-*-*-120-*-*-p-*-*"
+       fontset="sans-bold-12"
+       font ="sans-bold-12"
        fg[PRELIGHT] = { 0.80, 0.80, 0.70 }
 }
 
@@ -344,8 +335,8 @@ style "red_when_active" = "medium_text"
 
 style "xrun_warn"  
 {
-       font ="-*-helvetica-bold-r-normal-*-*-180-*-*-p-*-*"
-       fontset="-*-helvetica-bold-r-normal-*-18-*-*-*-p-*-*-*"
+       font ="sans-bold-18"
+       fontset="sans-bold-18"
 
        fg[NORMAL] = { 1.0, 1.0, 1.0 }
        fg[ACTIVE] = { 1.0, 1.0, 1.0 }
@@ -482,14 +473,14 @@ style "small_red_on_black_entry"  = "small_bold_text"
 
 style "big_clock_display" = "medium_entry"
 {
-       fontset = "-*-courier-bold-r-*-*-34-*-*-*-*-*-*-*"
-       font = "-*-courier-bold-r-*-*-34-*-*-*-*-*-*-*"
+       fontset = "sans-34"
+       font = "sans-34"
 }
 
 style "transport_clock_display"
 {
-       fontset = "-*-helvetica-bold-r-*-*-18-*-*-*-*-*-*-*"
-       font = "-*-helvetica-bold-r-*-*-18-*-*-*-*-*-*-*"
+       fontset = "sans-bold-18"
+       font = "sans-bold-18"
        
        fg[NORMAL] = { 0.66, 0.97, 0.18 }
        fg[ACTIVE] = { 1.0, 0, 0.0 }
@@ -505,8 +496,8 @@ style "transport_clock_display"
 
 style "tempo_meter_clock_display"
 {
-       fontset = "-*-helvetica-bold-r-*-*-8-*-*-*-*-*-*-*"
-       font = "-*-helvetica-bold-r-*-*-8-*-*-*-*-*-*-*"
+       fontset = "sans-bold-8"
+       font = "sans-bold-8"
        fg[NORMAL] = { 1.0, 1.0, 1.0 }
        fg[ACTIVE] = { 1.0, 1.0, 0.0 }
        fg[SELECTED] = { 1.0, 0, 0 }
@@ -814,7 +805,7 @@ style "meter_metrics_strip" = "default_base"
 
 style "no_session_msg" 
 {
-       font = "-*-helvetica-medium-r-*-*-34-350-*-*-*-*-*-*"
+       font = "sans-34"
 }
 
 style "location_row_button" = "default_buttons_menus"
index dd3c14a23fd6fcdcdcaca5af9446ee7237c59064..8be662b5e504284e11d1042d315d5a1e22e06131 100644 (file)
@@ -237,6 +237,7 @@ AutomationLine::AutomationLine (string name, TimeAxisView& tv, ArdourCanvas::Gro
 
        line = new ArdourCanvas::Line (*group);
        line->property_width_pixels() = (guint)1;
+       line->set_data ("line", this);
 
        line->signal_event().connect (mem_fun (*this, &AutomationLine::event_handler));
 
index 58c42d3cbac996b45ad70d781e5d2d8b2d968cb3..0310dbbf4c591a5e941b1f379e2e055203dbf7a0 100644 (file)
@@ -324,7 +324,7 @@ Editor::Editor (AudioEngine& eng)
        initialize_canvas ();
 
        track_canvas_scroller.add (track_canvas);
-       track_canvas_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_NEVER);
+       track_canvas_scroller.set_policy (POLICY_NEVER, POLICY_NEVER);
        track_canvas_scroller.set_name ("TrackCanvasScroller");
 
        track_canvas_scroller.get_vadjustment()->signal_value_changed().connect (mem_fun(*this, &Editor::tie_vertical_scrolling));
@@ -343,7 +343,7 @@ Editor::Editor (AudioEngine& eng)
        edit_hscrollbar.signal_size_allocate().connect (mem_fun(*this, &Editor::hscroll_slider_allocate));
        
        time_canvas_scroller.add (time_canvas);
-       time_canvas_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_NEVER);
+       time_canvas_scroller.set_policy (POLICY_NEVER, POLICY_NEVER);
        time_canvas_scroller.set_hadjustment (*track_canvas_scroller.get_hadjustment());
        time_canvas_scroller.set_name ("TimeCanvasScroller");
 
@@ -441,17 +441,14 @@ Editor::Editor (AudioEngine& eng)
        edit_packer.set_homogeneous (false);
        edit_packer.set_name ("EditorWindow");
 
-//     edit_packer.attach (edit_hscroll_left_arrow_event,  0, 1, 0, 1,    Gtk::FILL,  0, 0, 0);
-//     edit_packer.attach (edit_hscroll_slider,            1, 2, 0, 1,    Gtk::FILL|Gtk::EXPAND,  0, 0, 0);
-//     edit_packer.attach (edit_hscroll_right_arrow_event, 2, 3, 0, 1,    Gtk::FILL,  0, 0, 0);
        edit_packer.attach (edit_hscrollbar,            1, 2, 0, 1,    FILL|EXPAND,  FILL, 0, 0);
 
-       edit_packer.attach (time_button_event_box,               0, 1, 1, 2,    FILL, FILL, 0, 0);
+       edit_packer.attach (time_button_event_box,          0, 1, 1, 2,    FILL, FILL, 0, 0);
        edit_packer.attach (time_canvas_event_box,          1, 2, 1, 2,    FILL|EXPAND, FILL, 0, 0);
 
-       edit_packer.attach (edit_controls_scroller,         0, 1, 2, 3,    FILL,                   FILL|EXPAND, 0, 0);
+       edit_packer.attach (edit_controls_scroller,         0, 1, 2, 3,    FILL,FILL, 0, 0);
        edit_packer.attach (track_canvas_event_box,         1, 2, 2, 3,    FILL|EXPAND, FILL|EXPAND, 0, 0);
-       edit_packer.attach (edit_vscrollbar,                2, 3, 2, 3,    FILL,                   FILL|EXPAND, 0, 0);
+       edit_packer.attach (edit_vscrollbar,                2, 3, 2, 3,    FILL,        FILL|EXPAND, 0, 0);
 
        edit_frame.set_name ("BaseFrame");
        edit_frame.set_shadow_type (SHADOW_IN);
@@ -462,38 +459,30 @@ Editor::Editor (AudioEngine& eng)
        ARDOUR_UI::instance()->tooltips().set_tip (zoom_in_button, _("Zoom in"));
        ARDOUR_UI::instance()->tooltips().set_tip (zoom_out_button, _("Zoom out"));
 
-//     zoom_onetoone_button.set_name ("EditorTimeButton");
        zoom_out_full_button.set_name ("EditorTimeButton");
-//     ARDOUR_UI::instance()->tooltips().set_tip (zoom_onetoone_button, _("Zoom in 1:1"));
        ARDOUR_UI::instance()->tooltips().set_tip (zoom_out_full_button, _("Zoom to session"));
 
        zoom_in_button.add (*(manage (new Gtk::Image (Gdk::Pixbuf::create_from_xpm_data(zoom_in_button_xpm)))));
        zoom_out_button.add (*(manage (new Gtk::Image (Gdk::Pixbuf::create_from_xpm_data(zoom_out_button_xpm)))));
        zoom_out_full_button.add (*(manage (new Gtk::Image (Gdk::Pixbuf::create_from_xpm_data(zoom_out_full_button_xpm)))));
-//     zoom_onetoone_button.add (*(manage (new Gtk::Image (zoom_onetoone_button_xpm))));
-
        
        zoom_in_button.signal_clicked().connect (bind (mem_fun(*this, &Editor::temporal_zoom_step), false));
        zoom_out_button.signal_clicked().connect (bind (mem_fun(*this, &Editor::temporal_zoom_step), true));
        zoom_out_full_button.signal_clicked().connect (mem_fun(*this, &Editor::temporal_zoom_session));
-//     zoom_onetoone_button.signal_clicked().connect (bind (mem_fun(*this, &Editor::temporal_zoom), 1.0));
        
        zoom_indicator_box.pack_start (zoom_out_button, false, false);
        zoom_indicator_box.pack_start (zoom_in_button, false, false);
        zoom_indicator_box.pack_start (zoom_range_clock, false, false); 
-//     zoom_indicator_box.pack_start (zoom_onetoone_button, false, false);
        zoom_indicator_box.pack_start (zoom_out_full_button, false, false);
        
        zoom_indicator_label.set_text (_("Zoom Span"));
        zoom_indicator_label.set_name ("ToolBarLabel");
 
-
        zoom_indicator_vbox.set_spacing (3);
        zoom_indicator_vbox.set_border_width (3);
        zoom_indicator_vbox.pack_start (zoom_indicator_label, false, false);
        zoom_indicator_vbox.pack_start (zoom_indicator_box, false, false);
 
-
        bottom_hbox.set_border_width (3);
        bottom_hbox.set_spacing (3);
 
@@ -1008,73 +997,6 @@ Editor::on_realize ()
        null_cursor = new Gdk::Cursor(empty_pixmap, empty_bitmap, white, white, 0, 0);
 }
 
-void
-Editor::track_canvas_allocate (Gtk::Allocation alloc)
-{
-       canvas_width = alloc.get_width();
-       canvas_height = alloc.get_height();
-
-       if (session == 0 && !ARDOUR_UI::instance()->will_create_new_session_automatically()) {
-
-               Pango::FontDescription font = get_font_for_style (N_("FirstActionMessage"));
-
-               const char *txt1 = _("Start a new session\n");
-               const char *txt2 = _("via Session menu");
-
-               /* this mess of code is here to find out how wide this text is and
-                  position the message in the center of the editor window. there
-                  are two lines, so we use the longer of the the lines to
-                  compute width, and multiply the height by 2.
-               */
-                       
-               int pixel_height;
-               int pixel_width;
-               
-               /* this is a dummy widget that exists so that we can get the
-                  style from the RC file. 
-               */
-               
-               Label foo (_(txt2));
-               Glib::RefPtr<Pango::Layout> layout;
-               foo.set_name ("NoSessionMessage");
-               foo.ensure_style ();
-               
-               layout = foo.create_pango_layout (_(txt2));
-               layout->set_font_description (font);
-               layout->get_pixel_size (pixel_width, pixel_height);
-                       
-               if (first_action_message == 0) {
-                       
-                       char txt[strlen(txt1)+strlen(txt2)+1];
-                       
-                       /* merge both lines */
-                       
-                       strcpy (txt, _(txt1));
-                       strcat (txt, _(txt2));
-                       
-                       first_action_message = new ArdourCanvas::Text (*track_canvas.root());
-                       first_action_message->property_font_desc() = font;
-                       first_action_message->property_fill_color_rgba() = color_map[cFirstActionMessage];
-                       first_action_message->property_x() = (gdouble) (canvas_width - pixel_width) / 2.0;
-                       first_action_message->property_y() = (gdouble) (canvas_height/2.0) - (2.0 * (pixel_height));
-                       first_action_message->property_anchor() = ANCHOR_NORTH_WEST;
-                       first_action_message->property_text() = ustring (txt);
-                       
-               } else {
-
-                       /* center it */
-                       first_action_message->property_x() = (gdouble) (canvas_width - pixel_width) / 2.0;
-                       first_action_message->property_y() = (gdouble) (canvas_height/2.0) - (2.0 * (pixel_height));
-               }
-       }
-
-       zoom_range_clock.set ((jack_nframes_t) (canvas_width * frames_per_unit));
-       edit_cursor->set_position (edit_cursor->current_frame);
-       playhead_cursor->set_position (playhead_cursor->current_frame);
-       reset_scrolling_region (&alloc);
-       
-       Resized (); /* EMIT_SIGNAL */
-}
 
 void
 Editor::queue_session_control_changed (Session::ControlType t)
index 46b625407a6bbaaf931498b8ae62bcfee50b3eb3..f0c91ce89da92da0348ab581afb08da5c45035cd 100644 (file)
@@ -21,6 +21,7 @@
 #include <libgnomecanvasmm/init.h>
 #include <jack/types.h>
 
+#include "ardour_ui.h"
 #include "editor.h"
 #include "waveview.h"
 #include "simplerect.h"
@@ -82,10 +83,10 @@ Editor::initialize_canvas ()
 {
        ArdourCanvas::init ();
        ardour_canvas_type_init ();
+       
+       /* don't try to center the canvas */
 
-       /* adjust sensitivity for "picking" items */
-
-       // GNOME_CANVAS(track_canvas)->close_enough = 2;
+       track_canvas.set_center_scroll_region (false);
 
        track_canvas.signal_event().connect (bind (mem_fun (*this, &Editor::track_canvas_event), (ArdourCanvas::Item*) 0));
        track_canvas.set_name ("EditorMainCanvas");
@@ -259,67 +260,92 @@ Editor::initialize_canvas ()
 }
 
 void
-Editor::reset_scrolling_region (Gtk::Allocation* alloc)
+Editor::track_canvas_allocate (Gtk::Allocation alloc)
 {
-       guint32 last_canvas_unit;
-       double height;
-       guint32 canvas_alloc_height, canvas_alloc_width;
-       TrackViewList::iterator i;
        static bool first_time = true;
 
-       /* We need to make sure that the canvas always has its
-          scrolling region set to larger of:
+       canvas_width = alloc.get_width();
+       canvas_height = alloc.get_height();
 
-          - the size allocated for it (within the container its packed in)
-          - the size required to see the entire session
+       if (session == 0 && !ARDOUR_UI::instance()->will_create_new_session_automatically()) {
 
-          If we don't ensure at least the first of these, the canvas
-          does some wierd and in my view unnecessary stuff to center
-          itself within the allocated area, which causes bad, bad
-          results.
-          
-          XXX GnomeCanvas has fixed this, and has an option to
-          control the centering behaviour.
-       */
+               Pango::FontDescription font = get_font_for_style (N_("FirstActionMessage"));
 
-       last_canvas_unit = (guint32) ceil ((float) max_frames / frames_per_unit);
+               cerr << "font for style = "
+                    << font.get_family() << ' '
+                    << font.get_size() << ' '
+                    << font.get_weight() << ' '
+                    << font.get_variant() << ' '
+                    << endmsg;
 
-       height = 0;
+               const char *txt1 = _("Start a new session\n");
+               const char *txt2 = _("via Session menu");
 
-       if (session) {
-               for (i = track_views.begin(); i != track_views.end(); ++i) {
-                       if ((*i)->control_parent) {
-                               height += (*i)->effective_height;
-                               height += track_spacing;
-                       }
-               }
+               /* this mess of code is here to find out how wide this text is and
+                  position the message in the center of the editor window. there
+                  are two lines, so we use the longer of the the lines to
+                  compute width, and multiply the height by 2.
+               */
+                       
+               int pixel_height;
+               int pixel_width;
                
-               if (height) {
-                       height -= track_spacing;
+               /* this is a dummy widget that exists so that we can get the
+                  style from the RC file. 
+               */
+               
+               Label foo (_(txt2));
+               Glib::RefPtr<Pango::Layout> layout;
+
+               top_hbox.pack_start (foo);
+               foo.set_name ("FirstActionMessage");
+               foo.ensure_style ();
+
+               layout = foo.create_pango_layout (_(txt2));
+               layout->set_font_description (font);
+               layout->set_font_description (font);
+               layout->get_pixel_size (pixel_width, pixel_height);
+                       
+               top_hbox.remove (foo);
+
+               if (first_action_message == 0) {
+                       
+                       char txt[strlen(txt1)+strlen(txt2)+1];
+                       
+                       /* merge both lines */
+                       
+                       strcpy (txt, _(txt1));
+                       strcat (txt, _(txt2));
+                       
+                       first_action_message = new ArdourCanvas::Text (*track_canvas.root());
+                       first_action_message->property_font_desc() = font;
+                       first_action_message->property_fill_color_rgba() = color_map[cFirstActionMessage];
+                       first_action_message->property_x() = (gdouble) (canvas_width - pixel_width) / 2.0;
+                       first_action_message->property_y() = (gdouble) (canvas_height/2.0) - (2.0 * (pixel_height));
+                       first_action_message->property_anchor() = ANCHOR_NORTH_WEST;
+                       first_action_message->property_text() = ustring (txt);
+                       
+               } else {
+
+                       /* center it */
+                       first_action_message->property_x() = (gdouble) (canvas_width - pixel_width) / 2.0;
+                       first_action_message->property_y() = (gdouble) (canvas_height/2.0) - (2.0 * (pixel_height));
                }
        }
 
-       canvas_height = (guint32) height;
-       
-       if (alloc) {
-               canvas_alloc_height = alloc->get_height();
-               canvas_alloc_width = alloc->get_width();
-       } else {
-               canvas_alloc_height = track_canvas.get_height();
-               canvas_alloc_width = track_canvas.get_width();
-       }
-
-       canvas_height = max (canvas_height, canvas_alloc_height);
-       track_canvas.set_scroll_region ( 0.0, 0.0, max (last_canvas_unit, canvas_alloc_width), canvas_height);
+       zoom_range_clock.set ((jack_nframes_t) (canvas_width * frames_per_unit));
+       edit_cursor->set_position (edit_cursor->current_frame);
+       playhead_cursor->set_position (playhead_cursor->current_frame);
+       reset_scrolling_region (&alloc);
 
-       if (edit_cursor) edit_cursor->set_length (canvas_alloc_height);
-       if (playhead_cursor) playhead_cursor->set_length (canvas_alloc_height);
+       if (edit_cursor) edit_cursor->set_length (canvas_height);
+       if (playhead_cursor) playhead_cursor->set_length (canvas_height);
 
        if (marker_drag_line) {
                marker_drag_line_points.back().set_x(canvas_height);
-               // cerr << "set mlA points, nc = " << marker_drag_line_points.num_points << endl;
                marker_drag_line->property_points() = marker_drag_line_points;
        }
+
        if (range_marker_drag_rect) {
                range_marker_drag_rect->property_y1() = 0.0;
                range_marker_drag_rect->property_y2() = (double) canvas_height;
@@ -353,6 +379,65 @@ Editor::reset_scrolling_region (Gtk::Allocation* alloc)
        } else {
                redisplay_tempo ();
        }
+       
+       Resized (); /* EMIT_SIGNAL */
+}
+
+void
+Editor::reset_scrolling_region (Gtk::Allocation* alloc)
+{
+       guint32 last_canvas_unit;
+       double height;
+       guint32 canvas_alloc_height, canvas_alloc_width;
+       TrackViewList::iterator i;
+
+       /* We need to make sure that the canvas always has its
+          scrolling region set to larger of:
+
+          - the size allocated for it (within the container its packed in)
+          - the size required to see the entire session
+
+          If we don't ensure at least the first of these, the canvas
+          does some wierd and in my view unnecessary stuff to center
+          itself within the allocated area, which causes bad, bad
+          results.
+          
+          XXX GnomeCanvas has fixed this, and has an option to
+          control the centering behaviour.
+       */
+
+#if 0
+       last_canvas_unit = (guint32) ceil ((float) max_frames / frames_per_unit);
+
+       height = 0;
+
+       if (session) {
+               for (i = track_views.begin(); i != track_views.end(); ++i) {
+                       if ((*i)->control_parent) {
+                               height += (*i)->effective_height;
+                               height += track_spacing;
+                       }
+               }
+               
+               if (height) {
+                       height -= track_spacing;
+               }
+       }
+
+       canvas_height = (guint32) height;
+#endif
+       
+       if (alloc) {
+               canvas_alloc_height = alloc->get_height();
+               canvas_alloc_width = alloc->get_width();
+       } else {
+               canvas_alloc_height = track_canvas.get_height();
+               canvas_alloc_width = track_canvas.get_width();
+       }
+
+       canvas_height = 0;
+       canvas_height = max (canvas_height, canvas_alloc_height);
+       track_canvas.set_scroll_region ( 0.0, 0.0, max (last_canvas_unit, canvas_alloc_width), canvas_height);
 }
 
 bool
index 86f1e7d320698fc704278eb4dc7f4a1e189c86cc..bfe85f69a387972d6118316b1a5f39869c349390 100644 (file)
@@ -15,6 +15,8 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
+    $Id$
+
 */
 
 #include <unistd.h>
@@ -98,26 +100,17 @@ ExportDialog::ExportDialog(PublicEditor& e, AudioRegion* r)
          editor (e),
          format_table (9, 2),
          format_frame (_("FORMAT")),
-         channel_count_label (_("CHANNELS")),
-         channel_count_align(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, 0.0, 0.0),
-         header_format_label (_("FILE TYPE")),
-         header_format_align(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, 0.0, 0.0),
-         bitdepth_format_label (_("SAMPLE FORMAT")),
-         bitdepth_format_align(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, 0.0, 0.0),
-         endian_format_label (_("SAMPLE ENDIANNESS")),
-         endian_format_align(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, 0.0, 0.0),
-         sample_rate_label (_("SAMPLE RATE")),
-         sample_rate_align(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, 0.0, 0.0),
-         src_quality_label (_("CONVERSION QUALITY")),
-         src_quality_align(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, 0.0, 0.0),
-         dither_type_label (_("DITHER TYPE")),
-         dither_type_align(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, 0.0, 0.0),
-         cue_file_label (_("CD MARKER FILE TYPE")),
-         cue_file_align(Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, 0.0, 0.0),
+         cue_file_label (_("CD MARKER FILE TYPE"), 1.0, 0.5),
+         channel_count_label (_("CHANNELS"), 1.0, 0.5),
+         header_format_label (_("FILE TYPE"), 1.0, 0.5),
+         bitdepth_format_label (_("SAMPLE FORMAT"), 1.0, 0.5),
+         endian_format_label (_("SAMPLE ENDIANNESS"), 1.0, 0.5),
+         sample_rate_label (_("SAMPLE RATE"), 1.0, 0.5),
+         src_quality_label (_("CONVERSION QUALITY"), 1.0, 0.5),
+         dither_type_label (_("DITHER TYPE"), 1.0, 0.5),
          cuefile_only_checkbox (_("EXPORT CD MARKER FILE ONLY")),
          file_frame (_("EXPORT TO FILE")),
          file_browse_button (_("Browse")),
-         ok_button (_("Export")),
          track_selector_button (_("Specific tracks ..."))
 {
        guint32 n;
@@ -207,7 +200,6 @@ ExportDialog::ExportDialog(PublicEditor& e, AudioRegion* r)
        track_selector_button.set_name ("EditorGTKButton");
        track_selector_button.signal_clicked().connect (mem_fun(*this, &ExportDialog::track_selector_button_click));
 
-       get_vbox()->pack_start (button_box, false, false);
        get_vbox()->pack_start (progress_bar, false, false);
 
        Gtkmm2ext::set_size_request_to_display_given_text (file_entry, X_("Kg/quite/a/reasonable/size/for/files/i/think"), 5, 8);
@@ -222,23 +214,33 @@ ExportDialog::ExportDialog(PublicEditor& e, AudioRegion* r)
        file_frame.set_name (FRAME_NAME);
 
        /* pop_strings needs to be created on the stack because set_popdown_strings()
-        * takes a reference. */
+          takes a reference. 
+       */
+
        vector<string> pop_strings = internationalize(sample_rates);
        Gtkmm2ext::set_popdown_strings (sample_rate_combo, pop_strings);
-       pop_strings = internationalize(sample_rates);
+       sample_rate_combo.set_active_text (pop_strings.front());
+       pop_strings = internationalize(src_quality);
        Gtkmm2ext::set_popdown_strings (src_quality_combo, pop_strings);
+       src_quality_combo.set_active_text (pop_strings.front());
        pop_strings = internationalize(dither_types);
        Gtkmm2ext::set_popdown_strings (dither_type_combo, pop_strings);
+       dither_type_combo.set_active_text (pop_strings.front());
        pop_strings = internationalize(channel_strings);
        Gtkmm2ext::set_popdown_strings (channel_count_combo, pop_strings);
+       channel_count_combo.set_active_text (pop_strings.front());
        pop_strings = internationalize((const char **) sndfile_header_formats_strings);
        Gtkmm2ext::set_popdown_strings (header_format_combo, pop_strings);
+       header_format_combo.set_active_text (pop_strings.front());
        pop_strings = internationalize((const char **) sndfile_bitdepth_formats_strings);
        Gtkmm2ext::set_popdown_strings (bitdepth_format_combo, pop_strings);
+       bitdepth_format_combo.set_active_text (pop_strings.front());
        pop_strings = internationalize((const char **) sndfile_endian_formats_strings);
        Gtkmm2ext::set_popdown_strings (endian_format_combo, pop_strings);
+       endian_format_combo.set_active_text (pop_strings.front());
        pop_strings = internationalize(cue_file_types);
        Gtkmm2ext::set_popdown_strings (cue_file_combo, pop_strings);
+       cue_file_combo.set_active_text (pop_strings.front());
 
        /* this will re-sensitized as soon as a non RIFF/WAV
           header format is chosen.
@@ -322,57 +324,40 @@ ExportDialog::ExportDialog(PublicEditor& e, AudioRegion* r)
        format_table.set_row_spacings (5);
 
        if (!audio_region) {
-               channel_count_align.add(channel_count_label);
-               format_table.attach (channel_count_align, 0, 1, 0, 1);
+               format_table.attach (channel_count_label, 0, 1, 0, 1);
                format_table.attach (channel_count_combo, 1, 2, 0, 1);
        }
 
-       header_format_align.add(header_format_label);
-       format_table.attach (header_format_align, 0, 1, 1, 2);
+       format_table.attach (header_format_label, 0, 1, 1, 2);
        format_table.attach (header_format_combo, 1, 2, 1, 2);
 
-       bitdepth_format_align.add(bitdepth_format_label);
-       format_table.attach (bitdepth_format_align, 0, 1, 2, 3);
+       format_table.attach (bitdepth_format_label, 0, 1, 2, 3);
        format_table.attach (bitdepth_format_combo, 1, 2, 2, 3);
 
-       endian_format_align.add(endian_format_label);
-       format_table.attach (endian_format_align, 0, 1, 3, 4);
+       format_table.attach (endian_format_label, 0, 1, 3, 4);
        format_table.attach (endian_format_combo, 1, 2, 3, 4);
 
-       sample_rate_align.add(sample_rate_label);
-       format_table.attach (sample_rate_align, 0, 1, 4, 5);
+       format_table.attach (sample_rate_label, 0, 1, 4, 5);
        format_table.attach (sample_rate_combo, 1, 2, 4, 5);
 
-       src_quality_align.add(src_quality_label);
-       format_table.attach (src_quality_align, 0, 1, 5, 6);
+       format_table.attach (src_quality_label, 0, 1, 5, 6);
        format_table.attach (src_quality_combo, 1, 2, 5, 6);
 
-       dither_type_align.add(dither_type_label);
-       format_table.attach (dither_type_align, 0, 1, 6, 7);
+       format_table.attach (dither_type_label, 0, 1, 6, 7);
        format_table.attach (dither_type_combo, 1, 2, 6, 7);
 
-       cue_file_align.add(cue_file_label);
-       format_table.attach (cue_file_align, 0, 1, 7, 8);
+       format_table.attach (cue_file_label, 0, 1, 7, 8);
        format_table.attach (cue_file_combo, 1, 2, 7, 8);
        format_table.attach (cuefile_only_checkbox, 0, 2, 8, 9);
 
-
-       button_box.set_border_width (6);
-       button_box.set_spacing (20);
-       button_box.set_homogeneous (true);
-
-       cancel_button.add (cancel_label);
-
-       button_box.pack_start (ok_button, false, true);
-       button_box.pack_start (cancel_button, false, true);
-       
-       ok_button.set_name ("EditorGTKButton");
-       cancel_button.set_name ("EditorGTKButton");
        file_entry.set_name ("ExportFileDisplay");
 
        signal_delete_event().connect (mem_fun(*this, &ExportDialog::window_closed));
-       ok_button.signal_clicked().connect (mem_fun(*this, &ExportDialog::do_export));
-       cancel_button.signal_clicked().connect (mem_fun(*this, &ExportDialog::end_dialog));
+
+       ok_button = add_button (Stock::OK, RESPONSE_ACCEPT);
+       ok_button->signal_clicked().connect (mem_fun(*this, &ExportDialog::do_export));
+       cancel_button = add_button (Stock::CANCEL, RESPONSE_CANCEL);
+       cancel_button->signal_clicked().connect (mem_fun(*this, &ExportDialog::end_dialog));
        
        file_browse_button.set_name ("EditorGTKButton");
        file_browse_button.signal_clicked().connect (mem_fun(*this, &ExportDialog::initiate_browse));
@@ -947,9 +932,9 @@ ExportDialog::do_export ()
                return;
        }
 
-       ok_button.set_sensitive(false);
+       ok_button->set_sensitive(false);
        save_state();
-               
+
        set_modal (true);
        
        spec.path = filepath;
@@ -1123,7 +1108,7 @@ ExportDialog::end_dialog ()
        }
 
        set_modal (false);
-       ok_button.set_sensitive(true);
+       ok_button->set_sensitive(true);
 }
 
 void
index 597e2b3c21e97d67f3f46a65d0a4435d0614aca6..c07cebaa960b3d257d71d983dc38c7a196b0511c 100644 (file)
@@ -76,43 +76,34 @@ class ExportDialog : public ArdourDialog
        ARDOUR::AudioRegion* audio_region;
        Gtk::VBox   track_vpacker;
        Gtk::HBox   hpacker;
-       Gtk::HBox   button_box;
 
        Gtk::Table  format_table;
        Gtk::Frame  format_frame;
 
+       Gtk::Label  cue_file_label;
+       Gtk::ComboBoxText cue_file_combo;
+       
        Gtk::Label  channel_count_label;
-       Gtk::Alignment channel_count_align;
        Gtk::ComboBoxText channel_count_combo;
 
        Gtk::Label  header_format_label;
-       Gtk::Alignment header_format_align;
        Gtk::ComboBoxText header_format_combo;
 
        Gtk::Label  bitdepth_format_label;
-       Gtk::Alignment bitdepth_format_align;
        Gtk::ComboBoxText bitdepth_format_combo;
 
        Gtk::Label  endian_format_label;
-       Gtk::Alignment endian_format_align;
        Gtk::ComboBoxText endian_format_combo;
        
        Gtk::Label  sample_rate_label;
-       Gtk::Alignment sample_rate_align;
        Gtk::ComboBoxText sample_rate_combo;
 
        Gtk::Label  src_quality_label;
-       Gtk::Alignment src_quality_align;
        Gtk::ComboBoxText src_quality_combo;
 
        Gtk::Label  dither_type_label;
-       Gtk::Alignment dither_type_align;
        Gtk::ComboBoxText dither_type_combo;
 
-       Gtk::Label  cue_file_label;
-       Gtk::Alignment cue_file_align;
-       Gtk::ComboBoxText cue_file_combo;
-       
        Gtk::CheckButton cuefile_only_checkbox;
 
        Gtk::Frame  file_frame;
@@ -120,8 +111,8 @@ class ExportDialog : public ArdourDialog
        Gtk::HBox   file_hbox;
        Gtk::Button file_browse_button;
 
-       Gtk::Button ok_button;
-       Gtk::Button cancel_button;
+       Gtk::Button* ok_button;
+       Gtk::Button* cancel_button;
        Gtk::Label  cancel_label;
        Gtk::ProgressBar progress_bar;
        Gtk::ScrolledWindow track_scroll;
index 5e5f687c808a0db58e5252b29bfd098490a0816f..dcb6372afac61d7c63aa8f4da3186bb0f81c407f 100644 (file)
@@ -2,30 +2,36 @@
  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  *
  * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2 of the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
+ * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
 
 /*
- * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
+ * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
  * file for a list of people on the GTK+ Team.  See the ChangeLog
  * files for a list of changes.  These files are distributed with
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
+#include <config.h>
+#include <math.h>
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtkbindings.h>
+#include <gtk/gtkmarshalers.h>
 #include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtksignal.h>
+#include <gtk/gtkintl.h>
+#include <gtk/gtkalias.h>
 
 
 /* scrolled window policy and size requisition handling:
@@ -35,7 +41,7 @@
  *   to be best suited to display its contents, including children.
  *   the width and/or height reported from a widget upon size requisition
  *   may be overidden by the user by specifying a width and/or height
- *   other than 0 through gtk_widget_set_size_request().
+ *   other than 0 through gtk_widget_set_usize().
  *
  * a scrolled window needs (for imlementing all three policy types) to
  * request its width and height based on two different rationales.
  *    under A) at least correspond to the space taken up by its scrollbars.
  */
 
-#define SCROLLBAR_SPACING(w) (GTK_SCROLLED_WINDOW_CLASS (GTK_OBJECT (w)->klass)->scrollbar_spacing)
-
 #define DEFAULT_SCROLLBAR_SPACING  3
 
 enum {
-  ARG_0,
-  ARG_HADJUSTMENT,
-  ARG_VADJUSTMENT,
-  ARG_HSCROLLBAR_POLICY,
-  ARG_VSCROLLBAR_POLICY,
-  ARG_WINDOW_PLACEMENT
+  PROP_0,
+  PROP_HADJUSTMENT,
+  PROP_VADJUSTMENT,
+  PROP_HSCROLLBAR_POLICY,
+  PROP_VSCROLLBAR_POLICY,
+  PROP_WINDOW_PLACEMENT,
+  PROP_SHADOW_TYPE,
+  PROP_LAST
 };
 
+/* Signals */
+enum
+{
+  SCROLL_CHILD,
+  MOVE_FOCUS_OUT,
+  LAST_SIGNAL
+};
 
 static void gtk_scrolled_window_class_init         (GtkScrolledWindowClass *klass);
 static void gtk_scrolled_window_init               (GtkScrolledWindow      *scrolled_window);
-static void gtk_scrolled_window_set_arg                   (GtkObject              *object,
-                                                   GtkArg                 *arg,
-                                                   guint                   arg_id);
-static void gtk_scrolled_window_get_arg                   (GtkObject              *object,
-                                                   GtkArg                 *arg,
-                                                   guint                   arg_id);
 static void gtk_scrolled_window_destroy            (GtkObject              *object);
-static void gtk_scrolled_window_finalize           (GtkObject              *object);
-static void gtk_scrolled_window_map                (GtkWidget              *widget);
-static void gtk_scrolled_window_unmap              (GtkWidget              *widget);
-static void gtk_scrolled_window_draw               (GtkWidget              *widget,
-                                                   GdkRectangle           *area);
+static void gtk_scrolled_window_finalize           (GObject                *object);
+static void gtk_scrolled_window_set_property       (GObject                *object,
+                                                   guint                   prop_id,
+                                                   const GValue           *value,
+                                                   GParamSpec             *pspec);
+static void gtk_scrolled_window_get_property       (GObject                *object,
+                                                   guint                   prop_id,
+                                                   GValue                 *value,
+                                                   GParamSpec             *pspec);
+
+static gint gtk_scrolled_window_expose             (GtkWidget              *widget,
+                                                   GdkEventExpose         *event);
 static void gtk_scrolled_window_size_request       (GtkWidget              *widget,
                                                    GtkRequisition         *requisition);
 static void gtk_scrolled_window_size_allocate      (GtkWidget              *widget,
                                                    GtkAllocation          *allocation);
+static gint gtk_scrolled_window_scroll_event       (GtkWidget              *widget,
+                                                   GdkEventScroll         *event);
+static gint gtk_scrolled_window_focus              (GtkWidget              *widget,
+                                                   GtkDirectionType        direction);
 static void gtk_scrolled_window_add                (GtkContainer           *container,
                                                    GtkWidget              *widget);
 static void gtk_scrolled_window_remove             (GtkContainer           *container,
@@ -103,165 +121,219 @@ static void gtk_scrolled_window_forall             (GtkContainer           *cont
                                                    gboolean                include_internals,
                                                    GtkCallback             callback,
                                                    gpointer                callback_data);
+static void gtk_scrolled_window_scroll_child       (GtkScrolledWindow      *scrolled_window,
+                                                   GtkScrollType           scroll,
+                                                   gboolean                horizontal);
+static void gtk_scrolled_window_move_focus_out     (GtkScrolledWindow      *scrolled_window,
+                                                   GtkDirectionType        direction_type);
+
 static void gtk_scrolled_window_relative_allocation(GtkWidget              *widget,
                                                    GtkAllocation          *allocation);
 static void gtk_scrolled_window_adjustment_changed (GtkAdjustment          *adjustment,
                                                    gpointer                data);
 
-
 static GtkContainerClass *parent_class = NULL;
 
+static guint signals[LAST_SIGNAL] = {0};
 
-GtkType
+GType
 gtk_scrolled_window_get_type (void)
 {
-  static GtkType scrolled_window_type = 0;
+  static GType scrolled_window_type = 0;
 
   if (!scrolled_window_type)
     {
-      static const GtkTypeInfo scrolled_window_info =
+      static const GTypeInfo scrolled_window_info =
       {
-       "GtkScrolledWindow",
-       sizeof (GtkScrolledWindow),
        sizeof (GtkScrolledWindowClass),
-       (GtkClassInitFunc) gtk_scrolled_window_class_init,
-       (GtkObjectInitFunc) gtk_scrolled_window_init,
-       /* reserved_1 */ NULL,
-        /* reserved_2 */ NULL,
-        (GtkClassInitFunc) NULL,
+       NULL,           /* base_init */
+       NULL,           /* base_finalize */
+       (GClassInitFunc) gtk_scrolled_window_class_init,
+       NULL,           /* class_finalize */
+       NULL,           /* class_data */
+       sizeof (GtkScrolledWindow),
+       0,              /* n_preallocs */
+       (GInstanceInitFunc) gtk_scrolled_window_init,
       };
 
-      scrolled_window_type = gtk_type_unique (GTK_TYPE_BIN, &scrolled_window_info);
+      scrolled_window_type =
+       g_type_register_static (GTK_TYPE_BIN, "GtkScrolledWindow",
+                               &scrolled_window_info, 0);
     }
 
   return scrolled_window_type;
 }
 
+static void
+add_scroll_binding (GtkBindingSet  *binding_set,
+                   guint           keyval,
+                   GdkModifierType mask,
+                   GtkScrollType   scroll,
+                   gboolean        horizontal)
+{
+  guint keypad_keyval = keyval - GDK_Left + GDK_KP_Left;
+  
+  gtk_binding_entry_add_signal (binding_set, keyval, mask,
+                                "scroll_child", 2,
+                                GTK_TYPE_SCROLL_TYPE, scroll,
+                               G_TYPE_BOOLEAN, horizontal);
+  gtk_binding_entry_add_signal (binding_set, keypad_keyval, mask,
+                                "scroll_child", 2,
+                                GTK_TYPE_SCROLL_TYPE, scroll,
+                               G_TYPE_BOOLEAN, horizontal);
+}
+
+static void
+add_tab_bindings (GtkBindingSet    *binding_set,
+                 GdkModifierType   modifiers,
+                 GtkDirectionType  direction)
+{
+  gtk_binding_entry_add_signal (binding_set, GDK_Tab, modifiers,
+                                "move_focus_out", 1,
+                                GTK_TYPE_DIRECTION_TYPE, direction);
+  gtk_binding_entry_add_signal (binding_set, GDK_KP_Tab, modifiers,
+                                "move_focus_out", 1,
+                                GTK_TYPE_DIRECTION_TYPE, direction);
+}
+
 static void
 gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
 {
+  GObjectClass *gobject_class = G_OBJECT_CLASS (class);
   GtkObjectClass *object_class;
   GtkWidgetClass *widget_class;
   GtkContainerClass *container_class;
+  GtkBindingSet *binding_set;
 
   object_class = (GtkObjectClass*) class;
   widget_class = (GtkWidgetClass*) class;
   container_class = (GtkContainerClass*) class;
-  parent_class = gtk_type_class (GTK_TYPE_BIN);
-
-  gtk_object_add_arg_type ("GtkScrolledWindow::hadjustment",
-                          GTK_TYPE_ADJUSTMENT,
-                          GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT,
-                          ARG_HADJUSTMENT);
-  gtk_object_add_arg_type ("GtkScrolledWindow::vadjustment",
-                          GTK_TYPE_ADJUSTMENT,
-                          GTK_ARG_READWRITE | GTK_ARG_CONSTRUCT,
-                          ARG_VADJUSTMENT);
-  gtk_object_add_arg_type ("GtkScrolledWindow::hscrollbar_policy",
-                          GTK_TYPE_POLICY_TYPE,
-                          GTK_ARG_READWRITE,
-                          ARG_HSCROLLBAR_POLICY);
-  gtk_object_add_arg_type ("GtkScrolledWindow::vscrollbar_policy",
-                          GTK_TYPE_POLICY_TYPE,
-                          GTK_ARG_READWRITE,
-                          ARG_VSCROLLBAR_POLICY);
-  gtk_object_add_arg_type ("GtkScrolledWindow::window_placement",
-                          GTK_TYPE_CORNER_TYPE,
-                          GTK_ARG_READWRITE,
-                          ARG_WINDOW_PLACEMENT);
-
-  object_class->set_arg = gtk_scrolled_window_set_arg;
-  object_class->get_arg = gtk_scrolled_window_get_arg;
+
+  parent_class = g_type_class_peek_parent (class);
+
+  gobject_class->finalize = gtk_scrolled_window_finalize;
+  gobject_class->set_property = gtk_scrolled_window_set_property;
+  gobject_class->get_property = gtk_scrolled_window_get_property;
+
   object_class->destroy = gtk_scrolled_window_destroy;
-  object_class->finalize = gtk_scrolled_window_finalize;
 
-  widget_class->map = gtk_scrolled_window_map;
-  widget_class->unmap = gtk_scrolled_window_unmap;
-  widget_class->draw = gtk_scrolled_window_draw;
+  widget_class->expose_event = gtk_scrolled_window_expose;
   widget_class->size_request = gtk_scrolled_window_size_request;
   widget_class->size_allocate = gtk_scrolled_window_size_allocate;
+  widget_class->scroll_event = gtk_scrolled_window_scroll_event;
+  widget_class->focus = gtk_scrolled_window_focus;
 
   container_class->add = gtk_scrolled_window_add;
   container_class->remove = gtk_scrolled_window_remove;
   container_class->forall = gtk_scrolled_window_forall;
 
-  class->scrollbar_spacing = DEFAULT_SCROLLBAR_SPACING;
-}
-
-static void
-gtk_scrolled_window_set_arg (GtkObject        *object,
-                            GtkArg           *arg,
-                            guint             arg_id)
-{
-  GtkScrolledWindow *scrolled_window;
+  class->scrollbar_spacing = -1;
 
-  scrolled_window = GTK_SCROLLED_WINDOW (object);
+  class->scroll_child = gtk_scrolled_window_scroll_child;
+  class->move_focus_out = gtk_scrolled_window_move_focus_out;
+  
+  g_object_class_install_property (gobject_class,
+                                  PROP_HADJUSTMENT,
+                                  g_param_spec_object ("hadjustment",
+                                                       P_("Horizontal Adjustment"),
+                                                       P_("The GtkAdjustment for the horizontal position"),
+                                                       GTK_TYPE_ADJUSTMENT,
+                                                       G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+  g_object_class_install_property (gobject_class,
+                                  PROP_VADJUSTMENT,
+                                  g_param_spec_object ("vadjustment",
+                                                       P_("Vertical Adjustment"),
+                                                       P_("The GtkAdjustment for the vertical position"),
+                                                       GTK_TYPE_ADJUSTMENT,
+                                                       G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+  g_object_class_install_property (gobject_class,
+                                   PROP_HSCROLLBAR_POLICY,
+                                   g_param_spec_enum ("hscrollbar_policy",
+                                                      P_("Horizontal Scrollbar Policy"),
+                                                      P_("When the horizontal scrollbar is displayed"),
+                                                     GTK_TYPE_POLICY_TYPE,
+                                                     GTK_POLICY_ALWAYS,
+                                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
+  g_object_class_install_property (gobject_class,
+                                   PROP_VSCROLLBAR_POLICY,
+                                   g_param_spec_enum ("vscrollbar_policy",
+                                                      P_("Vertical Scrollbar Policy"),
+                                                      P_("When the vertical scrollbar is displayed"),
+                                                     GTK_TYPE_POLICY_TYPE,
+                                                     GTK_POLICY_ALWAYS,
+                                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+  g_object_class_install_property (gobject_class,
+                                   PROP_WINDOW_PLACEMENT,
+                                   g_param_spec_enum ("window_placement",
+                                                      P_("Window Placement"),
+                                                      P_("Where the contents are located with respect to the scrollbars"),
+                                                     GTK_TYPE_CORNER_TYPE,
+                                                     GTK_CORNER_TOP_LEFT,
+                                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
+  g_object_class_install_property (gobject_class,
+                                   PROP_SHADOW_TYPE,
+                                   g_param_spec_enum ("shadow_type",
+                                                      P_("Shadow Type"),
+                                                      P_("Style of bevel around the contents"),
+                                                     GTK_TYPE_SHADOW_TYPE,
+                                                     GTK_SHADOW_NONE,
+                                                      G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+  gtk_widget_class_install_style_property (widget_class,
+                                          g_param_spec_int ("scrollbar_spacing",
+                                                            P_("Scrollbar spacing"),
+                                                            P_("Number of pixels between the scrollbars and the scrolled window"),
+                                                            0,
+                                                            G_MAXINT,
+                                                            DEFAULT_SCROLLBAR_SPACING,
+                                                            G_PARAM_READABLE));
+
+  signals[SCROLL_CHILD] =
+    g_signal_new ("scroll_child",
+                  G_TYPE_FROM_CLASS (object_class),
+                  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+                  G_STRUCT_OFFSET (GtkScrolledWindowClass, scroll_child),
+                  NULL, NULL,
+                  _gtk_marshal_VOID__ENUM_BOOLEAN,
+                  G_TYPE_NONE, 2,
+                  GTK_TYPE_SCROLL_TYPE,
+                 G_TYPE_BOOLEAN);
+  signals[MOVE_FOCUS_OUT] =
+    g_signal_new ("move_focus_out",
+                  G_TYPE_FROM_CLASS (object_class),
+                  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+                  G_STRUCT_OFFSET (GtkScrolledWindowClass, move_focus_out),
+                  NULL, NULL,
+                  _gtk_marshal_VOID__ENUM,
+                  G_TYPE_NONE, 1,
+                  GTK_TYPE_DIRECTION_TYPE);
+  
+  binding_set = gtk_binding_set_by_class (class);
 
-  switch (arg_id)
-    {
-    case ARG_HADJUSTMENT:
-      gtk_scrolled_window_set_hadjustment (scrolled_window, GTK_VALUE_POINTER (*arg));
-      break;
-    case ARG_VADJUSTMENT:
-      gtk_scrolled_window_set_vadjustment (scrolled_window, GTK_VALUE_POINTER (*arg));
-      break;
-    case ARG_HSCROLLBAR_POLICY:
-      gtk_scrolled_window_set_policy (scrolled_window,
-                                     GTK_VALUE_ENUM (*arg),
-                                     scrolled_window->vscrollbar_policy);
-      break;
-    case ARG_VSCROLLBAR_POLICY:
-      gtk_scrolled_window_set_policy (scrolled_window,
-                                     scrolled_window->hscrollbar_policy,
-                                     GTK_VALUE_ENUM (*arg));
-      break;
-    case ARG_WINDOW_PLACEMENT:
-      gtk_scrolled_window_set_placement (scrolled_window,
-                                        GTK_VALUE_ENUM (*arg));
-      break;
-    default:
-      break;
-    }
-}
+  add_scroll_binding (binding_set, GDK_Left,  GDK_CONTROL_MASK, GTK_SCROLL_STEP_BACKWARD, TRUE);
+  add_scroll_binding (binding_set, GDK_Right, GDK_CONTROL_MASK, GTK_SCROLL_STEP_FORWARD,  TRUE);
+  add_scroll_binding (binding_set, GDK_Up,    GDK_CONTROL_MASK, GTK_SCROLL_STEP_BACKWARD, FALSE);
+  add_scroll_binding (binding_set, GDK_Down,  GDK_CONTROL_MASK, GTK_SCROLL_STEP_FORWARD,  FALSE);
 
-static void
-gtk_scrolled_window_get_arg (GtkObject        *object,
-                            GtkArg           *arg,
-                            guint             arg_id)
-{
-  GtkScrolledWindow *scrolled_window;
+  add_scroll_binding (binding_set, GDK_Page_Up,   GDK_CONTROL_MASK, GTK_SCROLL_PAGE_BACKWARD, TRUE);
+  add_scroll_binding (binding_set, GDK_Page_Down, GDK_CONTROL_MASK, GTK_SCROLL_PAGE_FORWARD,  TRUE);
+  add_scroll_binding (binding_set, GDK_Page_Up,   0,                GTK_SCROLL_PAGE_BACKWARD, FALSE);
+  add_scroll_binding (binding_set, GDK_Page_Down, 0,                GTK_SCROLL_PAGE_FORWARD,  FALSE);
 
-  scrolled_window = GTK_SCROLLED_WINDOW (object);
+  add_scroll_binding (binding_set, GDK_Home, GDK_CONTROL_MASK, GTK_SCROLL_START, TRUE);
+  add_scroll_binding (binding_set, GDK_End,  GDK_CONTROL_MASK, GTK_SCROLL_END,   TRUE);
+  add_scroll_binding (binding_set, GDK_Home, 0,                GTK_SCROLL_START, FALSE);
+  add_scroll_binding (binding_set, GDK_End,  0,                GTK_SCROLL_END,   FALSE);
 
-  switch (arg_id)
-    {
-    case ARG_HADJUSTMENT:
-      GTK_VALUE_POINTER (*arg) = gtk_scrolled_window_get_hadjustment (scrolled_window);
-      break;
-    case ARG_VADJUSTMENT:
-      GTK_VALUE_POINTER (*arg) = gtk_scrolled_window_get_vadjustment (scrolled_window);
-      break;
-    case ARG_HSCROLLBAR_POLICY:
-      GTK_VALUE_ENUM (*arg) = scrolled_window->hscrollbar_policy;
-      break;
-    case ARG_VSCROLLBAR_POLICY:
-      GTK_VALUE_ENUM (*arg) = scrolled_window->vscrollbar_policy;
-      break;
-    case ARG_WINDOW_PLACEMENT:
-      GTK_VALUE_ENUM (*arg) = scrolled_window->window_placement;
-      break;
-    default:
-      arg->type = GTK_TYPE_INVALID;
-      break;
-    }
+  add_tab_bindings (binding_set, GDK_CONTROL_MASK, GTK_DIR_TAB_FORWARD);
+  add_tab_bindings (binding_set, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD);
 }
 
 static void
 gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window)
 {
-  GTK_WIDGET_SET_FLAGS (scrolled_window, GTK_NO_WINDOW);
-
-  gtk_container_set_resize_mode (GTK_CONTAINER (scrolled_window), GTK_RESIZE_QUEUE);
+  GTK_WIDGET_SET_FLAGS (scrolled_window, GTK_NO_WINDOW | GTK_CAN_FOCUS);
 
   scrolled_window->hscrollbar = NULL;
   scrolled_window->vscrollbar = NULL;
@@ -269,7 +341,9 @@ gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window)
   scrolled_window->vscrollbar_policy = GTK_POLICY_ALWAYS;
   scrolled_window->hscrollbar_visible = FALSE;
   scrolled_window->vscrollbar_visible = FALSE;
+  scrolled_window->focus_out = FALSE;
   scrolled_window->window_placement = GTK_CORNER_TOP_LEFT;
+  
 }
 
 GtkWidget*
@@ -298,12 +372,11 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
 {
   GtkBin *bin;
 
-  g_return_if_fail (scrolled_window != NULL);
   g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
   if (hadjustment)
     g_return_if_fail (GTK_IS_ADJUSTMENT (hadjustment));
   else
-    hadjustment = (GtkAdjustment*) gtk_object_new (GTK_TYPE_ADJUSTMENT, NULL);
+    hadjustment = (GtkAdjustment*) g_object_new (GTK_TYPE_ADJUSTMENT, NULL);
 
   bin = GTK_BIN (scrolled_window);
 
@@ -315,7 +388,7 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
       gtk_widget_pop_composite_child ();
 
       gtk_widget_set_parent (scrolled_window->hscrollbar, GTK_WIDGET (scrolled_window));
-      gtk_widget_ref (scrolled_window->hscrollbar);
+      g_object_ref (scrolled_window->hscrollbar);
       gtk_widget_show (scrolled_window->hscrollbar);
     }
   else
@@ -326,23 +399,25 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
       if (old_adjustment == hadjustment)
        return;
 
-      gtk_signal_disconnect_by_func (GTK_OBJECT (old_adjustment),
-                                    GTK_SIGNAL_FUNC (gtk_scrolled_window_adjustment_changed),
-                                    scrolled_window);
+      g_signal_handlers_disconnect_by_func (old_adjustment,
+                                           gtk_scrolled_window_adjustment_changed,
+                                           scrolled_window);
       gtk_range_set_adjustment (GTK_RANGE (scrolled_window->hscrollbar),
                                hadjustment);
     }
   hadjustment = gtk_range_get_adjustment (GTK_RANGE (scrolled_window->hscrollbar));
-  gtk_signal_connect (GTK_OBJECT (hadjustment),
-                     "changed",
-                     GTK_SIGNAL_FUNC (gtk_scrolled_window_adjustment_changed),
-                     scrolled_window);
+  g_signal_connect (hadjustment,
+                   "changed",
+                   G_CALLBACK (gtk_scrolled_window_adjustment_changed),
+                   scrolled_window);
   gtk_scrolled_window_adjustment_changed (hadjustment, scrolled_window);
   
   if (bin->child)
     gtk_widget_set_scroll_adjustments (bin->child,
                                       gtk_range_get_adjustment (GTK_RANGE (scrolled_window->hscrollbar)),
                                       gtk_range_get_adjustment (GTK_RANGE (scrolled_window->vscrollbar)));
+
+  g_object_notify (G_OBJECT (scrolled_window), "hadjustment");
 }
 
 void
@@ -351,12 +426,11 @@ gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window,
 {
   GtkBin *bin;
 
-  g_return_if_fail (scrolled_window != NULL);
   g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
   if (vadjustment)
     g_return_if_fail (GTK_IS_ADJUSTMENT (vadjustment));
   else
-    vadjustment = (GtkAdjustment*) gtk_object_new (GTK_TYPE_ADJUSTMENT, NULL);
+    vadjustment = (GtkAdjustment*) g_object_new (GTK_TYPE_ADJUSTMENT, NULL);
 
   bin = GTK_BIN (scrolled_window);
 
@@ -368,7 +442,7 @@ gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window,
       gtk_widget_pop_composite_child ();
 
       gtk_widget_set_parent (scrolled_window->vscrollbar, GTK_WIDGET (scrolled_window));
-      gtk_widget_ref (scrolled_window->vscrollbar);
+      g_object_ref (scrolled_window->vscrollbar);
       gtk_widget_show (scrolled_window->vscrollbar);
     }
   else
@@ -379,29 +453,30 @@ gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window,
       if (old_adjustment == vadjustment)
        return;
 
-      gtk_signal_disconnect_by_func (GTK_OBJECT (old_adjustment),
-                                    GTK_SIGNAL_FUNC (gtk_scrolled_window_adjustment_changed),
-                                    scrolled_window);
+      g_signal_handlers_disconnect_by_func (old_adjustment,
+                                           gtk_scrolled_window_adjustment_changed,
+                                           scrolled_window);
       gtk_range_set_adjustment (GTK_RANGE (scrolled_window->vscrollbar),
                                vadjustment);
     }
   vadjustment = gtk_range_get_adjustment (GTK_RANGE (scrolled_window->vscrollbar));
-  gtk_signal_connect (GTK_OBJECT (vadjustment),
-                     "changed",
-                     GTK_SIGNAL_FUNC (gtk_scrolled_window_adjustment_changed),
-                     scrolled_window);
+  g_signal_connect (vadjustment,
+                   "changed",
+                   G_CALLBACK (gtk_scrolled_window_adjustment_changed),
+                   scrolled_window);
   gtk_scrolled_window_adjustment_changed (vadjustment, scrolled_window);
 
   if (bin->child)
     gtk_widget_set_scroll_adjustments (bin->child,
                                       gtk_range_get_adjustment (GTK_RANGE (scrolled_window->hscrollbar)),
                                       gtk_range_get_adjustment (GTK_RANGE (scrolled_window->vscrollbar)));
+
+  g_object_notify (G_OBJECT (scrolled_window), "vadjustment");
 }
 
 GtkAdjustment*
 gtk_scrolled_window_get_hadjustment (GtkScrolledWindow *scrolled_window)
 {
-  g_return_val_if_fail (scrolled_window != NULL, NULL);
   g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), NULL);
 
   return (scrolled_window->hscrollbar ?
@@ -412,7 +487,6 @@ gtk_scrolled_window_get_hadjustment (GtkScrolledWindow *scrolled_window)
 GtkAdjustment*
 gtk_scrolled_window_get_vadjustment (GtkScrolledWindow *scrolled_window)
 {
-  g_return_val_if_fail (scrolled_window != NULL, NULL);
   g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), NULL);
 
   return (scrolled_window->vscrollbar ?
@@ -425,7 +499,8 @@ gtk_scrolled_window_set_policy (GtkScrolledWindow *scrolled_window,
                                GtkPolicyType      hscrollbar_policy,
                                GtkPolicyType      vscrollbar_policy)
 {
-  g_return_if_fail (scrolled_window != NULL);
+  GObject *object = G_OBJECT (scrolled_window);
+  
   g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
 
   if ((scrolled_window->hscrollbar_policy != hscrollbar_policy) ||
@@ -435,14 +510,40 @@ gtk_scrolled_window_set_policy (GtkScrolledWindow *scrolled_window,
       scrolled_window->vscrollbar_policy = vscrollbar_policy;
 
       gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
+
+      g_object_freeze_notify (object);
+      g_object_notify (object, "hscrollbar-policy");
+      g_object_notify (object, "vscrollbar-policy");
+      g_object_thaw_notify (object);
     }
 }
 
+/**
+ * gtk_scrolled_window_get_policy:
+ * @scrolled_window: a #GtkScrolledWindow
+ * @hscrollbar_policy: location to store the policy for the horizontal scrollbar, or %NULL.
+ * @vscrollbar_policy: location to store the policy for the horizontal scrollbar, or %NULL.
+ * 
+ * Retrieves the current policy values for the horizontal and vertical
+ * scrollbars. See gtk_scrolled_window_set_policy().
+ **/
+void
+gtk_scrolled_window_get_policy (GtkScrolledWindow *scrolled_window,
+                               GtkPolicyType     *hscrollbar_policy,
+                               GtkPolicyType     *vscrollbar_policy)
+{
+  g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
+
+  if (hscrollbar_policy)
+    *hscrollbar_policy = scrolled_window->hscrollbar_policy;
+  if (vscrollbar_policy)
+    *vscrollbar_policy = scrolled_window->vscrollbar_policy;
+}
+
 void
 gtk_scrolled_window_set_placement (GtkScrolledWindow *scrolled_window,
                                   GtkCornerType      window_placement)
 {
-  g_return_if_fail (scrolled_window != NULL);
   g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
 
   if (scrolled_window->window_placement != window_placement)
@@ -450,15 +551,79 @@ gtk_scrolled_window_set_placement (GtkScrolledWindow *scrolled_window,
       scrolled_window->window_placement = window_placement;
 
       gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
+      
+      g_object_notify (G_OBJECT (scrolled_window), "window-placement");
     }
 }
 
+/**
+ * gtk_scrolled_window_get_placement:
+ * @scrolled_window: a #GtkScrolledWindow
+ *
+ * Gets the placement of the scrollbars for the scrolled window. See 
+ * gtk_scrolled_window_set_placement().
+ *
+ * Return value: the current placement value.
+ **/
+GtkCornerType
+gtk_scrolled_window_get_placement (GtkScrolledWindow *scrolled_window)
+{
+  g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), GTK_CORNER_TOP_LEFT);
+
+  return scrolled_window->window_placement;
+}
+
+/**
+ * gtk_scrolled_window_set_shadow_type:
+ * @scrolled_window: a #GtkScrolledWindow
+ * @type: kind of shadow to draw around scrolled window contents
+ *
+ * Changes the type of shadow drawn around the contents of
+ * @scrolled_window.
+ * 
+ **/
+void
+gtk_scrolled_window_set_shadow_type (GtkScrolledWindow *scrolled_window,
+                                    GtkShadowType      type)
+{
+  g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
+  g_return_if_fail (type >= GTK_SHADOW_NONE && type <= GTK_SHADOW_ETCHED_OUT);
+  
+  if (scrolled_window->shadow_type != type)
+    {
+      scrolled_window->shadow_type = type;
+
+      if (GTK_WIDGET_DRAWABLE (scrolled_window))
+       gtk_widget_queue_draw (GTK_WIDGET (scrolled_window));
+
+      gtk_widget_queue_resize (GTK_WIDGET (scrolled_window));
+
+      g_object_notify (G_OBJECT (scrolled_window), "shadow-type");
+    }
+}
+
+/**
+ * gtk_scrolled_window_get_shadow_type:
+ * @scrolled_window: a #GtkScrolledWindow
+ *
+ * Gets the shadow type of the scrolled window. See 
+ * gtk_scrolled_window_set_shadow_type().
+ *
+ * Return value: the current shadow type
+ **/
+GtkShadowType
+gtk_scrolled_window_get_shadow_type (GtkScrolledWindow *scrolled_window)
+{
+  g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_NONE);
+
+  return scrolled_window->shadow_type;
+}
+
 static void
 gtk_scrolled_window_destroy (GtkObject *object)
 {
   GtkScrolledWindow *scrolled_window;
 
-  g_return_if_fail (object != NULL);
   g_return_if_fail (GTK_IS_SCROLLED_WINDOW (object));
 
   scrolled_window = GTK_SCROLLED_WINDOW (object);
@@ -472,86 +637,132 @@ gtk_scrolled_window_destroy (GtkObject *object)
 }
 
 static void
-gtk_scrolled_window_finalize (GtkObject *object)
+gtk_scrolled_window_finalize (GObject *object)
 {
-  GtkScrolledWindow *scrolled_window;
-
-  scrolled_window = GTK_SCROLLED_WINDOW (object);
+  GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (object);
 
-  gtk_widget_unref (scrolled_window->hscrollbar);
-  gtk_widget_unref (scrolled_window->vscrollbar);
+  g_object_unref (scrolled_window->hscrollbar);
+  g_object_unref (scrolled_window->vscrollbar);
 
-  GTK_OBJECT_CLASS (parent_class)->finalize (object);
+  G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 static void
-gtk_scrolled_window_map (GtkWidget *widget)
+gtk_scrolled_window_set_property (GObject      *object,
+                                 guint         prop_id,
+                                 const GValue *value,
+                                 GParamSpec   *pspec)
 {
-  GtkScrolledWindow *scrolled_window;
-
-  g_return_if_fail (widget != NULL);
-  g_return_if_fail (GTK_IS_SCROLLED_WINDOW (widget));
-
-  scrolled_window = GTK_SCROLLED_WINDOW (widget);
-
-  /* chain parent class handler to map self and child */
-  GTK_WIDGET_CLASS (parent_class)->map (widget);
-  
-  if (GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar) &&
-      !GTK_WIDGET_MAPPED (scrolled_window->hscrollbar))
-    gtk_widget_map (scrolled_window->hscrollbar);
+  GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (object);
   
-  if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar) &&
-      !GTK_WIDGET_MAPPED (scrolled_window->vscrollbar))
-    gtk_widget_map (scrolled_window->vscrollbar);
+  switch (prop_id)
+    {
+    case PROP_HADJUSTMENT:
+      gtk_scrolled_window_set_hadjustment (scrolled_window,
+                                          g_value_get_object (value));
+      break;
+    case PROP_VADJUSTMENT:
+      gtk_scrolled_window_set_vadjustment (scrolled_window,
+                                          g_value_get_object (value));
+      break;
+    case PROP_HSCROLLBAR_POLICY:
+      gtk_scrolled_window_set_policy (scrolled_window,
+                                     g_value_get_enum (value),
+                                     scrolled_window->vscrollbar_policy);
+      break;
+    case PROP_VSCROLLBAR_POLICY:
+      gtk_scrolled_window_set_policy (scrolled_window,
+                                     scrolled_window->hscrollbar_policy,
+                                     g_value_get_enum (value));
+      break;
+    case PROP_WINDOW_PLACEMENT:
+      gtk_scrolled_window_set_placement (scrolled_window,
+                                        g_value_get_enum (value));
+      break;
+    case PROP_SHADOW_TYPE:
+      gtk_scrolled_window_set_shadow_type (scrolled_window,
+                                          g_value_get_enum (value));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
 }
 
 static void
-gtk_scrolled_window_unmap (GtkWidget *widget)
+gtk_scrolled_window_get_property (GObject    *object,
+                                 guint       prop_id,
+                                 GValue     *value,
+                                 GParamSpec *pspec)
 {
-  GtkScrolledWindow *scrolled_window;
-
-  g_return_if_fail (widget != NULL);
-  g_return_if_fail (GTK_IS_SCROLLED_WINDOW (widget));
-
-  scrolled_window = GTK_SCROLLED_WINDOW (widget);
-
-  /* chain parent class handler to unmap self and child */
-  GTK_WIDGET_CLASS (parent_class)->unmap (widget);
+  GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (object);
   
-  if (GTK_WIDGET_MAPPED (scrolled_window->hscrollbar))
-    gtk_widget_unmap (scrolled_window->hscrollbar);
-  
-  if (GTK_WIDGET_MAPPED (scrolled_window->vscrollbar))
-    gtk_widget_unmap (scrolled_window->vscrollbar);
+  switch (prop_id)
+    {
+    case PROP_HADJUSTMENT:
+      g_value_set_object (value,
+                         G_OBJECT (gtk_scrolled_window_get_hadjustment (scrolled_window)));
+      break;
+    case PROP_VADJUSTMENT:
+      g_value_set_object (value,
+                         G_OBJECT (gtk_scrolled_window_get_vadjustment (scrolled_window)));
+      break;
+    case PROP_HSCROLLBAR_POLICY:
+      g_value_set_enum (value, scrolled_window->hscrollbar_policy);
+      break;
+    case PROP_VSCROLLBAR_POLICY:
+      g_value_set_enum (value, scrolled_window->vscrollbar_policy);
+      break;
+    case PROP_WINDOW_PLACEMENT:
+      g_value_set_enum (value, scrolled_window->window_placement);
+      break;
+    case PROP_SHADOW_TYPE:
+      g_value_set_enum (value, scrolled_window->shadow_type);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
 }
 
 static void
-gtk_scrolled_window_draw (GtkWidget    *widget,
-                         GdkRectangle *area)
+gtk_scrolled_window_paint (GtkWidget    *widget,
+                          GdkRectangle *area)
 {
-  GtkScrolledWindow *scrolled_window;
-  GtkBin *bin;
-  GdkRectangle child_area;
+  GtkAllocation relative_allocation;
+  GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
 
-  g_return_if_fail (widget != NULL);
-  g_return_if_fail (GTK_IS_SCROLLED_WINDOW (widget));
-  g_return_if_fail (area != NULL);
-  
-  scrolled_window = GTK_SCROLLED_WINDOW (widget);
-  bin = GTK_BIN (widget);
+  if (scrolled_window->shadow_type != GTK_SHADOW_NONE)
+    {
+      gtk_scrolled_window_relative_allocation (widget, &relative_allocation);
+      
+      relative_allocation.x -= widget->style->xthickness;
+      relative_allocation.y -= widget->style->ythickness;
+      relative_allocation.width += 2 * widget->style->xthickness;
+      relative_allocation.height += 2 * widget->style->ythickness;
+      
+      gtk_paint_shadow (widget->style, widget->window,
+                       GTK_STATE_NORMAL, scrolled_window->shadow_type,
+                       area, widget, "scrolled_window",
+                       widget->allocation.x + relative_allocation.x,
+                       widget->allocation.y + relative_allocation.y,
+                       relative_allocation.width,
+                       relative_allocation.height);
+    }
+}
 
-  if (bin->child && GTK_WIDGET_VISIBLE (bin->child) &&
-      gtk_widget_intersect (bin->child, area, &child_area))
-    gtk_widget_draw (bin->child, &child_area);
-  
-  if (GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar) &&
-      gtk_widget_intersect (scrolled_window->hscrollbar, area, &child_area))
-    gtk_widget_draw (scrolled_window->hscrollbar, &child_area);
-  
-  if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar) &&
-      gtk_widget_intersect (scrolled_window->vscrollbar, area, &child_area))
-    gtk_widget_draw (scrolled_window->vscrollbar, &child_area);
+static gint
+gtk_scrolled_window_expose (GtkWidget      *widget,
+                           GdkEventExpose *event)
+{
+  if (GTK_WIDGET_DRAWABLE (widget))
+    {
+      gtk_scrolled_window_paint (widget, &event->area);
+
+      (* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
+    }
+
+  return FALSE;
 }
 
 static void
@@ -560,7 +771,6 @@ gtk_scrolled_window_forall (GtkContainer *container,
                            GtkCallback   callback,
                            gpointer      callback_data)
 {
-  g_return_if_fail (container != NULL);
   g_return_if_fail (GTK_IS_SCROLLED_WINDOW (container));
   g_return_if_fail (callback != NULL);
 
@@ -581,6 +791,127 @@ gtk_scrolled_window_forall (GtkContainer *container,
     }
 }
 
+static void
+gtk_scrolled_window_scroll_child (GtkScrolledWindow *scrolled_window,
+                                 GtkScrollType      scroll,
+                                 gboolean           horizontal)
+{
+  GtkAdjustment *adjustment = NULL;
+  
+  switch (scroll)
+    {
+    case GTK_SCROLL_STEP_UP:
+      scroll = GTK_SCROLL_STEP_BACKWARD;
+      horizontal = FALSE;
+      break;
+    case GTK_SCROLL_STEP_DOWN:
+      scroll = GTK_SCROLL_STEP_FORWARD;
+      horizontal = FALSE;
+      break;
+    case GTK_SCROLL_STEP_LEFT:
+      scroll = GTK_SCROLL_STEP_BACKWARD;
+      horizontal = TRUE;
+      break;
+    case GTK_SCROLL_STEP_RIGHT:
+      scroll = GTK_SCROLL_STEP_FORWARD;
+      horizontal = TRUE;
+      break;
+    case GTK_SCROLL_PAGE_UP:
+      scroll = GTK_SCROLL_PAGE_BACKWARD;
+      horizontal = FALSE;
+      break;
+    case GTK_SCROLL_PAGE_DOWN:
+      scroll = GTK_SCROLL_PAGE_FORWARD;
+      horizontal = FALSE;
+      break;
+    case GTK_SCROLL_PAGE_LEFT:
+      scroll = GTK_SCROLL_STEP_BACKWARD;
+      horizontal = TRUE;
+      break;
+    case GTK_SCROLL_PAGE_RIGHT:
+      scroll = GTK_SCROLL_STEP_FORWARD;
+      horizontal = TRUE;
+      break;
+    case GTK_SCROLL_STEP_BACKWARD:
+    case GTK_SCROLL_STEP_FORWARD:
+    case GTK_SCROLL_PAGE_BACKWARD:
+    case GTK_SCROLL_PAGE_FORWARD:
+    case GTK_SCROLL_START:
+    case GTK_SCROLL_END:
+      break;
+    default:
+      g_warning ("Invalid scroll type %d for GtkSpinButton::change-value", scroll);
+      return;
+    }
+
+  if (horizontal)
+    {
+      if (scrolled_window->hscrollbar)
+       adjustment = gtk_range_get_adjustment (GTK_RANGE (scrolled_window->hscrollbar));
+    }
+  else
+    {
+      if (scrolled_window->vscrollbar)
+       adjustment = gtk_range_get_adjustment (GTK_RANGE (scrolled_window->vscrollbar));
+    }
+
+  if (adjustment)
+    {
+      gdouble value = adjustment->value;
+      
+      switch (scroll)
+       {
+       case GTK_SCROLL_STEP_FORWARD:
+         value += adjustment->step_increment;
+         break;
+       case GTK_SCROLL_STEP_BACKWARD:
+         value -= adjustment->step_increment;
+         break;
+       case GTK_SCROLL_PAGE_FORWARD:
+         value += adjustment->page_increment;
+         break;
+       case GTK_SCROLL_PAGE_BACKWARD:
+         value -= adjustment->page_increment;
+         break;
+       case GTK_SCROLL_START:
+         value = adjustment->lower;
+         break;
+       case GTK_SCROLL_END:
+         value = adjustment->upper;
+         break;
+       default:
+         g_assert_not_reached ();
+         break;
+       }
+
+      value = CLAMP (value, adjustment->lower, adjustment->upper - adjustment->page_size);
+      
+      gtk_adjustment_set_value (adjustment, value);
+    }
+}
+
+static void
+gtk_scrolled_window_move_focus_out (GtkScrolledWindow *scrolled_window,
+                                   GtkDirectionType   direction_type)
+{
+  GtkWidget *toplevel;
+  
+  /* Focus out of the scrolled window entirely. We do this by setting
+   * a flag, then propagating the focus motion to the notebook.
+   */
+  toplevel = gtk_widget_get_toplevel (GTK_WIDGET (scrolled_window));
+  if (!GTK_WIDGET_TOPLEVEL (toplevel))
+    return;
+
+  g_object_ref (scrolled_window);
+  
+  scrolled_window->focus_out = TRUE;
+  g_signal_emit_by_name (toplevel, "move_focus", direction_type);
+  scrolled_window->focus_out = FALSE;
+  
+  g_object_unref (scrolled_window);
+}
+
 static void
 gtk_scrolled_window_size_request (GtkWidget      *widget,
                                  GtkRequisition *requisition)
@@ -589,17 +920,19 @@ gtk_scrolled_window_size_request (GtkWidget      *widget,
   GtkBin *bin;
   gint extra_width;
   gint extra_height;
+  gint scrollbar_spacing;
   GtkRequisition hscrollbar_requisition;
   GtkRequisition vscrollbar_requisition;
   GtkRequisition child_requisition;
 
-  g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_SCROLLED_WINDOW (widget));
   g_return_if_fail (requisition != NULL);
 
   scrolled_window = GTK_SCROLLED_WINDOW (widget);
   bin = GTK_BIN (scrolled_window);
 
+  scrollbar_spacing = _gtk_scrolled_window_get_scrollbar_spacing (scrolled_window);
+
   extra_width = 0;
   extra_height = 0;
   requisition->width = 0;
@@ -612,20 +945,14 @@ gtk_scrolled_window_size_request (GtkWidget      *widget,
   
   if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
     {
-      static guint quark_aux_info = 0;
-
-      if (!quark_aux_info)
-       quark_aux_info = g_quark_from_static_string ("gtk-aux-info");
-
       gtk_widget_size_request (bin->child, &child_requisition);
 
       if (scrolled_window->hscrollbar_policy == GTK_POLICY_NEVER)
        requisition->width += child_requisition.width;
       else
        {
-         GtkWidgetAuxInfo *aux_info;
+         GtkWidgetAuxInfo *aux_info = _gtk_widget_get_aux_info (bin->child, FALSE);
 
-         aux_info = gtk_object_get_data_by_id (GTK_OBJECT (bin->child), quark_aux_info);
          if (aux_info && aux_info->width > 0)
            {
              requisition->width += aux_info->width;
@@ -636,12 +963,11 @@ gtk_scrolled_window_size_request (GtkWidget      *widget,
        }
 
 //      if (scrolled_window->vscrollbar_policy == GTK_POLICY_NEVER)
-//            requisition->height += child_requisition.height;
+//     requisition->height += child_requisition.height;
 //      else
        {
-         GtkWidgetAuxInfo *aux_info;
+         GtkWidgetAuxInfo *aux_info = _gtk_widget_get_aux_info (bin->child, FALSE);
 
-         aux_info = gtk_object_get_data_by_id (GTK_OBJECT (bin->child), quark_aux_info);
          if (aux_info && aux_info->height > 0)
            {
              requisition->height += aux_info->height;
@@ -657,7 +983,7 @@ gtk_scrolled_window_size_request (GtkWidget      *widget,
     {
       requisition->width = MAX (requisition->width, hscrollbar_requisition.width);
       if (!extra_height || scrolled_window->hscrollbar_policy == GTK_POLICY_ALWAYS)
-       extra_height = SCROLLBAR_SPACING (scrolled_window) + hscrollbar_requisition.height;
+       extra_height = scrollbar_spacing + hscrollbar_requisition.height;
     }
 
   if (scrolled_window->vscrollbar_policy == GTK_POLICY_AUTOMATIC ||
@@ -665,11 +991,17 @@ gtk_scrolled_window_size_request (GtkWidget      *widget,
     {
       requisition->height = MAX (requisition->height, vscrollbar_requisition.height);
       if (!extra_height || scrolled_window->vscrollbar_policy == GTK_POLICY_ALWAYS)
-       extra_width = SCROLLBAR_SPACING (scrolled_window) + vscrollbar_requisition.width;
+       extra_width = scrollbar_spacing + vscrollbar_requisition.width;
     }
 
   requisition->width += GTK_CONTAINER (widget)->border_width * 2 + MAX (0, extra_width);
   requisition->height += GTK_CONTAINER (widget)->border_width * 2 + MAX (0, extra_height);
+
+  if (scrolled_window->shadow_type != GTK_SHADOW_NONE)
+    {
+      requisition->width += 2 * widget->style->xthickness;
+      requisition->height += 2 * widget->style->ythickness;
+    }
 }
 
 static void
@@ -677,31 +1009,44 @@ gtk_scrolled_window_relative_allocation (GtkWidget     *widget,
                                         GtkAllocation *allocation)
 {
   GtkScrolledWindow *scrolled_window;
+  gint scrollbar_spacing;
 
   g_return_if_fail (widget != NULL);
   g_return_if_fail (allocation != NULL);
 
   scrolled_window = GTK_SCROLLED_WINDOW (widget);
+  scrollbar_spacing = _gtk_scrolled_window_get_scrollbar_spacing (scrolled_window);
 
   allocation->x = GTK_CONTAINER (widget)->border_width;
   allocation->y = GTK_CONTAINER (widget)->border_width;
+
+  if (scrolled_window->shadow_type != GTK_SHADOW_NONE)
+    {
+      allocation->x += widget->style->xthickness;
+      allocation->y += widget->style->ythickness;
+    }
+  
   allocation->width = MAX (1, (gint)widget->allocation.width - allocation->x * 2);
   allocation->height = MAX (1, (gint)widget->allocation.height - allocation->y * 2);
 
   if (scrolled_window->vscrollbar_visible)
     {
       GtkRequisition vscrollbar_requisition;
+      gboolean is_rtl;
+
       gtk_widget_get_child_requisition (scrolled_window->vscrollbar,
                                        &vscrollbar_requisition);
+      is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
   
-      if (scrolled_window->window_placement == GTK_CORNER_TOP_RIGHT ||
-         scrolled_window->window_placement == GTK_CORNER_BOTTOM_RIGHT)
-       allocation->x += (vscrollbar_requisition.width +
-                         SCROLLBAR_SPACING (scrolled_window));
-
-      allocation->width = MAX (1, (gint)allocation->width -
-                              ((gint)vscrollbar_requisition.width +
-                               (gint)SCROLLBAR_SPACING (scrolled_window)));
+      if ((!is_rtl && 
+          (scrolled_window->window_placement == GTK_CORNER_TOP_RIGHT ||
+           scrolled_window->window_placement == GTK_CORNER_BOTTOM_RIGHT)) ||
+         (is_rtl && 
+          (scrolled_window->window_placement == GTK_CORNER_TOP_LEFT ||
+           scrolled_window->window_placement == GTK_CORNER_BOTTOM_LEFT)))
+       allocation->x += (vscrollbar_requisition.width +  scrollbar_spacing);
+
+      allocation->width = MAX (1, allocation->width - (vscrollbar_requisition.width + scrollbar_spacing));
     }
   if (scrolled_window->hscrollbar_visible)
     {
@@ -711,12 +1056,9 @@ gtk_scrolled_window_relative_allocation (GtkWidget     *widget,
   
       if (scrolled_window->window_placement == GTK_CORNER_BOTTOM_LEFT ||
          scrolled_window->window_placement == GTK_CORNER_BOTTOM_RIGHT)
-       allocation->y += (hscrollbar_requisition.height +
-                         SCROLLBAR_SPACING (scrolled_window));
+       allocation->y += (hscrollbar_requisition.height + scrollbar_spacing);
 
-      allocation->height = MAX (1, (gint)allocation->height -
-                               ((gint)hscrollbar_requisition.height +
-                                (gint)SCROLLBAR_SPACING (scrolled_window)));
+      allocation->height = MAX (1, allocation->height - (hscrollbar_requisition.height + scrollbar_spacing));
     }
 }
 
@@ -728,14 +1070,16 @@ gtk_scrolled_window_size_allocate (GtkWidget     *widget,
   GtkBin *bin;
   GtkAllocation relative_allocation;
   GtkAllocation child_allocation;
+  gint scrollbar_spacing;
   
-  g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_SCROLLED_WINDOW (widget));
   g_return_if_fail (allocation != NULL);
 
   scrolled_window = GTK_SCROLLED_WINDOW (widget);
   bin = GTK_BIN (scrolled_window);
 
+  scrollbar_spacing = _gtk_scrolled_window_get_scrollbar_spacing (scrolled_window);
+
   widget->allocation = *allocation;
 
   if (scrolled_window->hscrollbar_policy == GTK_POLICY_ALWAYS)
@@ -805,7 +1149,9 @@ gtk_scrolled_window_size_allocate (GtkWidget     *widget,
          scrolled_window->window_placement == GTK_CORNER_TOP_RIGHT)
        child_allocation.y = (relative_allocation.y +
                              relative_allocation.height +
-                             SCROLLBAR_SPACING (scrolled_window));
+                             scrollbar_spacing +
+                             (scrolled_window->shadow_type == GTK_SHADOW_NONE ?
+                              0 : widget->style->ythickness));
       else
        child_allocation.y = GTK_CONTAINER (scrolled_window)->border_width;
 
@@ -814,6 +1160,12 @@ gtk_scrolled_window_size_allocate (GtkWidget     *widget,
       child_allocation.x += allocation->x;
       child_allocation.y += allocation->y;
 
+      if (scrolled_window->shadow_type != GTK_SHADOW_NONE)
+       {
+         child_allocation.x -= widget->style->xthickness;
+         child_allocation.width += 2 * widget->style->xthickness;
+       }
+
       gtk_widget_size_allocate (scrolled_window->hscrollbar, &child_allocation);
     }
   else if (GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar))
@@ -828,11 +1180,17 @@ gtk_scrolled_window_size_allocate (GtkWidget     *widget,
       gtk_widget_get_child_requisition (scrolled_window->vscrollbar,
                                        &vscrollbar_requisition);
 
-      if (scrolled_window->window_placement == GTK_CORNER_TOP_LEFT ||
-         scrolled_window->window_placement == GTK_CORNER_BOTTOM_LEFT)
+      if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL && 
+          (scrolled_window->window_placement == GTK_CORNER_TOP_RIGHT ||
+           scrolled_window->window_placement == GTK_CORNER_BOTTOM_RIGHT)) ||
+         (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR && 
+          (scrolled_window->window_placement == GTK_CORNER_TOP_LEFT ||
+           scrolled_window->window_placement == GTK_CORNER_BOTTOM_LEFT)))
        child_allocation.x = (relative_allocation.x +
                              relative_allocation.width +
-                             SCROLLBAR_SPACING (scrolled_window));
+                             scrollbar_spacing +
+                             (scrolled_window->shadow_type == GTK_SHADOW_NONE ?
+                              0 : widget->style->xthickness));
       else
        child_allocation.x = GTK_CONTAINER (scrolled_window)->border_width;
 
@@ -842,12 +1200,82 @@ gtk_scrolled_window_size_allocate (GtkWidget     *widget,
       child_allocation.x += allocation->x;
       child_allocation.y += allocation->y;
 
+      if (scrolled_window->shadow_type != GTK_SHADOW_NONE)
+       {
+         child_allocation.y -= widget->style->ythickness;
+         child_allocation.height += 2 * widget->style->ythickness;
+       }
+
       gtk_widget_size_allocate (scrolled_window->vscrollbar, &child_allocation);
     }
   else if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar))
     gtk_widget_hide (scrolled_window->vscrollbar);
 }
 
+static gint
+gtk_scrolled_window_scroll_event (GtkWidget *widget,
+                                 GdkEventScroll *event)
+{
+  GtkWidget *range;
+
+  g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (widget), FALSE);
+  g_return_val_if_fail (event != NULL, FALSE);  
+
+  if (event->direction == GDK_SCROLL_UP || event->direction == GDK_SCROLL_DOWN)
+    range = GTK_SCROLLED_WINDOW (widget)->vscrollbar;
+  else
+    range = GTK_SCROLLED_WINDOW (widget)->hscrollbar;
+
+  if (range && GTK_WIDGET_VISIBLE (range))
+    {
+      GtkAdjustment *adj = GTK_RANGE (range)->adjustment;
+      gdouble delta, new_value;
+
+      delta = _gtk_range_get_wheel_delta (GTK_RANGE (range), event->direction);
+
+      new_value = CLAMP (adj->value + delta, adj->lower, adj->upper - adj->page_size);
+      
+      gtk_adjustment_set_value (adj, new_value);
+
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
+static gint
+gtk_scrolled_window_focus (GtkWidget        *widget,
+                          GtkDirectionType  direction)
+{
+  GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
+  gboolean had_focus_child = GTK_CONTAINER (widget)->focus_child != NULL;
+  
+  if (scrolled_window->focus_out)
+    {
+      scrolled_window->focus_out = FALSE; /* Clear this to catch the wrap-around case */
+      return FALSE;
+    }
+  
+  if (gtk_widget_is_focus (widget))
+    return FALSE;
+
+  /* We only put the scrolled window itself in the focus chain if it
+   * isn't possible to focus any children.
+   */
+  if (GTK_BIN (widget)->child)
+    {
+      if (gtk_widget_child_focus (GTK_BIN (widget)->child, direction))
+       return TRUE;
+    }
+
+  if (!had_focus_child)
+    {
+      gtk_widget_grab_focus (widget);
+      return TRUE;
+    }
+  else
+    return FALSE;
+}
 
 static void
 gtk_scrolled_window_adjustment_changed (GtkAdjustment *adjustment,
@@ -860,7 +1288,8 @@ gtk_scrolled_window_adjustment_changed (GtkAdjustment *adjustment,
 
   scrolled_win = GTK_SCROLLED_WINDOW (data);
 
-  if (adjustment == gtk_range_get_adjustment (GTK_RANGE (scrolled_win->hscrollbar)))
+  if (scrolled_win->hscrollbar &&
+      adjustment == gtk_range_get_adjustment (GTK_RANGE (scrolled_win->hscrollbar)))
     {
       if (scrolled_win->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
        {
@@ -873,7 +1302,8 @@ gtk_scrolled_window_adjustment_changed (GtkAdjustment *adjustment,
            gtk_widget_queue_resize (GTK_WIDGET (scrolled_win));
        }
     }
-  else if (adjustment == gtk_range_get_adjustment (GTK_RANGE (scrolled_win->vscrollbar)))
+  else if (scrolled_win->vscrollbar &&
+          adjustment == gtk_range_get_adjustment (GTK_RANGE (scrolled_win->vscrollbar)))
     {
       if (scrolled_win->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
        {
@@ -909,24 +1339,12 @@ gtk_scrolled_window_add (GtkContainer *container,
                                          gtk_range_get_adjustment (GTK_RANGE (scrolled_window->vscrollbar))))
     g_warning ("gtk_scrolled_window_add(): cannot add non scrollable widget "
               "use gtk_scrolled_window_add_with_viewport() instead");
-
-  if (GTK_WIDGET_REALIZED (child->parent))
-    gtk_widget_realize (child);
-
-  if (GTK_WIDGET_VISIBLE (child->parent) && GTK_WIDGET_VISIBLE (child))
-    {
-      if (GTK_WIDGET_MAPPED (child->parent))
-       gtk_widget_map (child);
-
-      gtk_widget_queue_resize (child);
-    }
 }
 
 static void
 gtk_scrolled_window_remove (GtkContainer *container,
                            GtkWidget    *child)
 {
-  g_return_if_fail (container != NULL);
   g_return_if_fail (GTK_IS_SCROLLED_WINDOW (container));
   g_return_if_fail (child != NULL);
   g_return_if_fail (GTK_BIN (container)->child == child);
@@ -944,9 +1362,7 @@ gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrolled_window,
   GtkBin *bin;
   GtkWidget *viewport;
 
-  g_return_if_fail (scrolled_window != NULL);
   g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
-  g_return_if_fail (child != NULL);
   g_return_if_fail (GTK_IS_WIDGET (child));
   g_return_if_fail (child->parent == NULL);
 
@@ -970,3 +1386,38 @@ gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrolled_window,
   gtk_widget_show (viewport);
   gtk_container_add (GTK_CONTAINER (viewport), child);
 }
+
+/**
+ * _gtk_scrolled_window_get_spacing:
+ * @scrolled_window: a scrolled window
+ * 
+ * Gets the spacing between the scrolled window's scrollbars and
+ * the scrolled widget. Used by GtkCombo
+ * 
+ * Return value: the spacing, in pixels.
+ **/
+gint
+_gtk_scrolled_window_get_scrollbar_spacing (GtkScrolledWindow *scrolled_window)
+{
+  GtkScrolledWindowClass *class;
+    
+  g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), 0);
+
+  class = GTK_SCROLLED_WINDOW_GET_CLASS (scrolled_window);
+
+  if (class->scrollbar_spacing >= 0)
+    return class->scrollbar_spacing;
+  else
+    {
+      gint scrollbar_spacing;
+      
+      gtk_widget_style_get (GTK_WIDGET (scrolled_window),
+                           "scrollbar_spacing", &scrollbar_spacing,
+                           NULL);
+
+      return scrollbar_spacing;
+    }
+}
+
+#define __GTK_SCROLLED_WINDOW_C__
+#include "gtkaliasdef.c"
index dfacbc788adb8677794b306f805262bb67a1249f..2aaf2ccdd2d3db3cb747f7633bc98a4863123101 100644 (file)
@@ -322,7 +322,7 @@ int
 main (int argc, char *argv[])
 {
        ARDOUR::AudioEngine *engine;
-       char *null_file_list[] = { 0 };
+       vector<Glib::ustring> null_file_list;
 
        gtk_set_locale ();
 
@@ -337,7 +337,6 @@ main (int argc, char *argv[])
        text_receiver.listen_to (info);
        text_receiver.listen_to (fatal);
        text_receiver.listen_to (warning);
-       
 
        if (parse_opts (argc, argv)) {
                exit (1);
@@ -357,8 +356,8 @@ main (int argc, char *argv[])
                unsetenv("GTK_RC_FILES");
        }
 
-       gtk_rc_set_default_files (null_file_list);
-
+       RC::set_default_files (null_file_list);
+       
        cout << _("Ardour/GTK ") 
             << VERSIONSTRING
             << _("\n   (built using ")
@@ -411,17 +410,13 @@ main (int argc, char *argv[])
                engine = new ARDOUR::AudioEngine (jack_client_name);
                ARDOUR::init (*engine, use_vst, try_hw_optimization, handler2);
                ui->set_engine (*engine);
-       } 
-
-       catch (AudioEngine::NoBackendAvailable& err) {
+       } catch (AudioEngine::NoBackendAvailable& err) {
                gui_jack_error ();
                error << string_compose (_("Could not connect to JACK server as  \"%1\""), jack_client_name) <<  endmsg;
                return -1;
-       }
-       
-       catch (failed_constructor& err) {
+       } catch (failed_constructor& err) {
                error << _("could not initialize Ardour.") << endmsg;
-               exit (1);
+               return -1;
        } 
 
        /* load session, if given */
@@ -484,9 +479,10 @@ To create it from the command line, start ardour as \"ardour --new %1"), path)
                }
        }
 
-       ui->run (text_receiver);
+       if (!ui->set_quit_context ()) {
+               ui->run (text_receiver);
+       }
        
-       delete ui;
        ui = 0;
 
   out:
index d74b46f74f43c3ff56c60bb4cacd68987181ba27..3e6320f4d58444360484371733452d666388b794 100644 (file)
@@ -39,7 +39,7 @@ using namespace ARDOUR;
 using namespace Gtk;
 
 PluginSelector::PluginSelector (PluginManager *mgr)
-       : Dialog (_("ardour: plugins"), true, false)
+       : ArdourDialog (_("ardour: plugins"), true, false)
 {
        set_position (Gtk::WIN_POS_MOUSE);
        set_name ("PluginSelectorWindow");
@@ -58,6 +58,9 @@ PluginSelector::PluginSelector (PluginManager *mgr)
        ladspa_display.append_column (_("# Outputs"), lcols.outs);
        ladspa_display.set_headers_visible (true);
        ladspa_display.set_reorderable (false);
+       lscroller.set_border_width(10);
+       lscroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+       lscroller.add(ladspa_display);
 
        amodel = Gtk::ListStore::create(acols);
        added_list.set_model (amodel);
@@ -78,6 +81,9 @@ PluginSelector::PluginSelector (PluginManager *mgr)
        vst_display.append_column (_("# Outputs"), vcols.outs);
        vst_display.set_headers_visible (true);
        vst_display.set_reorderable (false);
+       vscroller.set_border_width(10);
+       vscroller.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
+       vscroller.add(vst_display);
 
        for (int i = 0; i <=2; i++) {
                column = vst_display.get_column(i);
@@ -94,7 +100,7 @@ PluginSelector::PluginSelector (PluginManager *mgr)
 
        btn_add->set_name("PluginSelectorButton");
        btn_remove->set_name("PluginSelectorButton");
-       
+
        Gtk::Table* table = manage(new Gtk::Table(7, 10));
        table->set_size_request(750, 500);
        table->attach(notebook, 0, 7, 0, 5);
@@ -111,10 +117,10 @@ PluginSelector::PluginSelector (PluginManager *mgr)
        get_vbox()->pack_start (*table);
 
        using namespace Gtk::Notebook_Helpers;
-       notebook.pages().push_back (TabElem (ladspa_display, _("LADSPA")));
+       notebook.pages().push_back (TabElem (lscroller, _("LADSPA")));
 #ifdef VST_SUPPORT
        if (Config->get_use_vst()) {
-               notebook.pages().push_back (TabElem (vst_display, _("VST")));
+               notebook.pages().push_back (TabElem (vscroller, _("VST")));
        }
 #endif
 
@@ -122,12 +128,6 @@ PluginSelector::PluginSelector (PluginManager *mgr)
        //ladspa_display.set_name("PluginSelectorDisplay");
        ladspa_display.set_name("PluginSelectorList");
        added_list.set_name("PluginSelectorList");
-       
-       //ladspa_display.clist().column(0).set_auto_resize (false);
-       //ladspa_display.clist().column(0).set_width(470);
-
-       //ladspa_display.clist().column(1).set_auto_resize (true);
-       //o_selector.clist().column(0).set_auto_resize (true);
 
        ladspa_display.signal_button_press_event().connect_notify (mem_fun(*this, &PluginSelector::row_clicked));
 #ifdef VST_SUPPORT
@@ -139,6 +139,8 @@ PluginSelector::PluginSelector (PluginManager *mgr)
        btn_update->signal_clicked().connect (mem_fun(*this, &PluginSelector::btn_update_clicked));
        btn_add->signal_clicked().connect(mem_fun(*this, &PluginSelector::btn_add_clicked));
        btn_remove->signal_clicked().connect(mem_fun(*this, &PluginSelector::btn_remove_clicked));
+
+       input_refiller ();
 }
 
 void
@@ -163,16 +165,9 @@ PluginSelector::set_session (Session* s)
 void
 PluginSelector::_input_refiller (void *arg)
 {
-       ((PluginSelector *) arg)->input_refiller ();
-}
 
-/*
-void
-PluginSelector::_output_refiller (void *arg)
-{
-       ((PluginSelector *) arg)->output_refiller ();
+       ((PluginSelector *) arg)->input_refiller ();
 }
-*/
 
 int compare(const void *left, const void *right)
 {
@@ -182,17 +177,16 @@ int compare(const void *left, const void *right)
 void
 PluginSelector::input_refiller ()
 {
-       //const gchar *rowdata[4];
        guint row;
        list<PluginInfo *> &plugs = manager->ladspa_plugin_info ();
        list<PluginInfo *>::iterator i;
        char ibuf[16], obuf[16];
-       
+       lmodel->clear();
+#ifdef VST_SUPPORT
+       vmodel->clear();
+#endif
        // Insert into GTK list
        for (row = 0, i=plugs.begin(); i != plugs.end(); ++i, ++row) {
-               //rowdata[0] = (*i)->name.c_str();
-               //rowdata[1] = (*i)->category.c_str();
-
                snprintf (ibuf, sizeof(ibuf)-1, "%d", (*i)->n_inputs);
                snprintf (obuf, sizeof(obuf)-1, "%d", (*i)->n_outputs);         
                
@@ -202,12 +196,9 @@ PluginSelector::input_refiller ()
                newrow[lcols.ins] = ibuf;
                newrow[lcols.outs] = obuf;
                newrow[lcols.plugin] = *i;
-               //clist.insert_row (row, rowdata);
-               //clist.rows().back().set_data (*i);
        }
 
-       //clist.set_sort_column (0);
-       //clist.sort ();
+       lmodel->set_sort_column (0, Gtk::SORT_ASCENDING);
 }
 
 #ifdef VST_SUPPORT
@@ -228,8 +219,6 @@ PluginSelector::vst_refiller ()
        
        // Insert into GTK list
        for (row = 0, i=plugs.begin(); i != plugs.end(); ++i, ++row) {
-               //rowdata[0] = (*i)->name.c_str();
-               //rowdata[1] = (*i)->category.c_str();
 
                snprintf (ibuf, sizeof(ibuf)-1, "%d", (*i)->n_inputs);
                snprintf (obuf, sizeof(obuf)-1, "%d", (*i)->n_outputs);         
@@ -240,30 +229,10 @@ PluginSelector::vst_refiller ()
                newrow[vcols.outs] = obuf;
                newrow[vcols.plugin] = i;
        }
-
-       //clist.set_sort_column (0);
-       //clist.sort ();
+       vmodel->set_sort_column (0, Gtk::SORT_ASCENDING);
 }
 #endif
 
-/*
-void
-PluginSelector::output_refiller ()
-{
-       const gchar *rowdata[2];
-       guint row;
-       list<PluginInfo*>::iterator i;
-       
-       // Insert into GTK list
-
-       for (row = 0, i = added_plugins.begin(); i != added_plugins.end(); ++i, ++row){
-               rowdata[0] = (*i)->name.c_str();
-               clist.insert_row (row, rowdata);
-               clist.rows().back().set_data (*i);
-       }
-}
-*/
-
 void
 PluginSelector::use_plugin (PluginInfo* pi)
 {
@@ -316,7 +285,6 @@ PluginSelector::btn_remove_clicked()
                        row++;
                }
                added_plugins.erase(i);
-               //o_selector.rescan();
                o_selected_plug = -1;
        }
 }
index 77eefd2c028e94c49ea5f9302ae0731688d3e0df..804223f2b478915c479f23f3fab90d6a4ce5ec37 100644 (file)
@@ -31,7 +31,7 @@ namespace ARDOUR {
        class Plugin;
 }
 
-class PluginSelector : public Gtk::Dialog
+class PluginSelector : public ArdourDialog
 {
   public:
        PluginSelector (ARDOUR::PluginManager *);
@@ -44,9 +44,10 @@ class PluginSelector : public Gtk::Dialog
   private:
        ARDOUR::Session* session;
        Gtk::Notebook notebook;
+       Gtk::ScrolledWindow lscroller;
+       Gtk::ScrolledWindow vscroller;
 
        // page 1
-       //Gtkmm2ext::Selector ladspa_display;
        struct LadspaColumns : public Gtk::TreeModel::ColumnRecord {
                LadspaColumns () {
                        add (name);
@@ -100,7 +101,6 @@ class PluginSelector : public Gtk::Dialog
        static void _vst_refiller (void *);
        void vst_refiller ();
 #endif 
-       //Gtkmm2ext::Selector o_selector;
 
        ARDOUR::PluginInfo* i_selected_plug;
 
@@ -112,8 +112,7 @@ class PluginSelector : public Gtk::Dialog
        list<ARDOUR::PluginInfo*> added_plugins;
 
        static void _input_refiller (void *);
-       //static void _output_refiller (void *);
-
+       
        void input_refiller ();
        void row_clicked(GdkEventButton *);
        void btn_add_clicked();
index 262b830d8a56b699d83f8a8c68fa881a22930771..958654dab5de976a218f7eb7cedf4812a3e93633 100644 (file)
@@ -75,7 +75,7 @@ PluginUIWindow::PluginUIWindow (AudioEngine &engine, PluginInsert& insert, bool
                        VSTPluginUI* vpu = new VSTPluginUI (insert, *vp);
                        
                        _pluginui = vpu;
-                       add (*vpu);
+                       get_vbox()->add (*vpu);
                        vpu->package (*this);
                        
                } else {
@@ -92,7 +92,7 @@ PluginUIWindow::PluginUIWindow (AudioEngine &engine, PluginInsert& insert, bool
                PluginUI*  pu  = new PluginUI (engine, insert, scrollable);
                
                _pluginui = pu;
-               add (*pu);
+               get_vbox()->add (*pu);
                
                signal_map_event().connect (mem_fun (*pu, &PluginUI::start_updating));
                signal_unmap_event().connect (mem_fun (*pu, &PluginUI::stop_updating));
@@ -233,9 +233,6 @@ PluginUI::build (AudioEngine &engine)
        frame->add (*box);
        hpacker.pack_start(*frame, true, true);
 
-       box->set_border_width (5);
-       box->set_spacing (1);
-       
        /* find all ports. build control elements for all appropriate control ports */
 
        for (i = 0; i < plugin.parameter_count(); ++i) {
index 95ce4110a4493e5ccf9b6382258df41a7bf71054..54179f54ef9d7eb8d97ea504b8d2e1f2da712108 100644 (file)
@@ -116,7 +116,7 @@ RedirectBox::RedirectBox (Placement pcmnt, Session& sess, Route& rt, PluginSelec
        _route.redirects_changed.connect (mem_fun(*this, &RedirectBox::redirects_changed));
 
        redirect_eventbox.signal_enter_notify_event().connect (bind (sigc::ptr_fun (RedirectBox::enter_box), this));
-       redirect_eventbox.signal_leave_notify_event().connect (bind (sigc::ptr_fun (RedirectBox::leave_box), this));
+       //redirect_eventbox.signal_leave_notify_event().connect (bind (sigc::ptr_fun (RedirectBox::leave_box), this));
 
        redirect_display.signal_button_press_event().connect (mem_fun(*this, &RedirectBox::redirect_button));
        redirect_display.signal_button_release_event().connect (mem_fun(*this, &RedirectBox::redirect_button));
@@ -262,7 +262,9 @@ RedirectBox::redirect_button (GdkEventButton *ev)
 {
        Redirect *redirect;
        TreeModel::Row row = *(redirect_display.get_selection()->get_selected());
-       redirect = row[columns.redirect];
+
+       if (row)
+               redirect = row[columns.redirect];
 
        switch (ev->type) {
        case GDK_BUTTON_PRESS:
@@ -374,6 +376,7 @@ void
 RedirectBox::choose_plugin ()
 {
        sigc::connection newplug_connection = _plugin_selector.PluginCreated.connect (mem_fun(*this,&RedirectBox::insert_plugin_chosen));
+       _plugin_selector.show_all();
        _plugin_selector.run ();
        newplug_connection.disconnect();
 }
index 9d1966b10ef4279dfbbfa98cbf6876a618607c7c..e34bb46a2d54761910cbf6223300954522e67bea 100644 (file)
@@ -409,9 +409,11 @@ url_decode (string& url)
 Pango::FontDescription
 get_font_for_style (string widgetname)
 {
+       Gtk::Window window (WINDOW_TOPLEVEL);
        Gtk::Label foobar;
        Glib::RefPtr<Style> style;
 
+       window.add (foobar);
        foobar.set_name (widgetname);
        foobar.ensure_style();
 
index 2da27872a948c1cace83da6b93c8b7d8f54dd347..1e5df91662a10264d718b1e37bc0aaaebf3834b4 100644 (file)
@@ -230,7 +230,13 @@ UI::quit ()
 void
 UI::do_quit ()
 {
-       Main::quit();
+       longjmp (quit_context, 1);
+}
+
+int
+UI::set_quit_context()
+{
+       return setjmp (quit_context);
 }
 
 void
index 359e8ca7439102484d6789056c0d62e1bfe8d649..92727577d05df045f04688c3f57e555afe7fa054 100644 (file)
@@ -25,6 +25,7 @@
 #include <queue>
 #include <map>
 
+#include <setjmp.h>
 #include <pthread.h>
 #include <gtkmm/widget.h>
 #include <gtkmm/style.h>
@@ -77,6 +78,7 @@ class UI : public AbstractUI
 
        /* Gtk-UI specific interfaces */
 
+       int  set_quit_context ();
        void set_tip (Gtk::Widget *, const gchar *txt, const gchar *hlp = 0);
        void set_state (Gtk::Widget *w, Gtk::StateType state);
        void idle_add (int (*)(void *), void *);
@@ -191,6 +193,8 @@ class UI : public AbstractUI
        void color_selection_done (bool status);
        bool color_selection_deleted (GdkEventAny *);
        bool color_picked;
+
+       jmp_buf quit_context;
 };
 
 template<class UI_CLASS> void *