#include <gtkmm/combo.h>
#include <gtkmm/label.h>
#include <gtkmm/paned.h>
-#include <gtkmm/action.h>
-#include <gtkmm/actiongroup.h>
-#include <gtkmm/accelgroup.h>
-#include <gtkmm/accelmap.h>
#include <gtk/gtkpaned.h>
#include <gtkmm2ext/utils.h>
#include "ardour_ui.h"
+#include "keyboard.h"
#include "utils.h"
#include "i18n.h"
#include "rgb_macros.h"
+#include "canvas_impl.h"
using namespace std;
using namespace Gtk;
}
string
-fit_to_pixels (string str, int pixel_width, string font)
+fit_to_pixels (ARDOUR::stringcr_t str, int pixel_width, ARDOUR::stringcr_t font)
{
Label foo;
int width;
gint
just_hide_it (GdkEventAny *ev, Gtk::Window *win)
{
- ARDOUR_UI::instance()->allow_focus (false);
win->hide_all ();
return TRUE;
}
-void
-allow_keyboard_focus (bool yn)
-{
- ARDOUR_UI::instance()->allow_focus (yn);
-}
-
/* xpm2rgb copied from nixieclock, which bore the legend:
nixieclock - a nixie desktop timepiece
return (savergb);
}
-GnomeCanvasPoints*
+ArdourCanvas::Points*
get_canvas_points (string who, uint32_t npoints)
{
// cerr << who << ": wants " << npoints << " canvas points" << endl;
abort ();
}
#endif
- return gnome_canvas_points_new (npoints);
+ return new ArdourCanvas::Points (npoints);
}
int
-channel_combo_get_channel_count (Gtk::Combo& combo)
+channel_combo_get_channel_count (Gtk::ComboBoxText& combo)
{
- string str = combo.get_entry()->get_text();
+ string str = combo.get_active_text();
int chns;
if (str == _("mono")) {
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();
uint32_t
rgba_from_style (string style, uint32_t r, uint32_t g, uint32_t b, uint32_t a)
{
+ /* In GTK+2, styles aren't set up correctly if the widget is not
+ attached to a toplevel window that has a screen pointer.
+ */
+
+ static Gtk::Window* window = 0;
+
+ if (window == 0) {
+ window = new Window (WINDOW_TOPLEVEL);
+ }
+
Gtk::Label foo;
+ window->add (foo);
+
foo.set_name (style);
foo.ensure_style ();
} else {
warning << string_compose (_("missing RGBA style for \"%1\""), style) << endl;
}
+
+ window->remove ();
return (uint32_t) RGBA_TO_UINT(r,g,b,a);
}
-void
-decorate (Gtk::Window& w, Gdk::WMDecoration d)
+bool
+canvas_item_visible (ArdourCanvas::Item* item)
{
- w.get_window()->set_decorations (d);
-}
-
-Glib::RefPtr<Action>
-register_action (Glib::RefPtr<ActionGroup> group, string name, string label, slot<void> sl, guint key, Gdk::ModifierType mods)
-{
- Glib::RefPtr<Action> act;
-
- act = Action::create (name, label);
- group->add (act, sl);
- AccelMap::add_entry (act->get_accel_path(), key, mods);
-
- return act;
-}
-
-Glib::RefPtr<Action>
-register_action (Glib::RefPtr<ActionGroup> group, string name, string label, slot<void> sl)
-{
- Glib::RefPtr<Action> act;
-
- act = Action::create (name, label);
- group->add (act, sl);
-
- return act;
-}
-
-Glib::RefPtr<Action>
-register_action (Glib::RefPtr<ActionGroup> group, string name, string label)
-{
- Glib::RefPtr<Action> act;
-
- act = Action::create (name, label);
- group->add (act);
-
- return act;
+ return (item->gobj()->object.flags & GNOME_CANVAS_ITEM_VISIBLE) ? true : false;
}