summaryrefslogtreecommitdiff
path: root/gtk2_ardour/utils.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gtk2_ardour/utils.cc')
-rw-r--r--gtk2_ardour/utils.cc43
1 files changed, 13 insertions, 30 deletions
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc
index a0fd7016b5..777eb62616 100644
--- a/gtk2_ardour/utils.cc
+++ b/gtk2_ardour/utils.cc
@@ -32,7 +32,6 @@
#include <fstream>
#include <list>
#include <sys/stat.h>
-#include <libart_lgpl/art_misc.h>
#include <gtkmm/rc.h>
#include <gtkmm/window.h>
#include <gtkmm/combo.h>
@@ -45,8 +44,8 @@
#include <gtkmm2ext/utils.h>
#include "ardour/rc_configuration.h"
-
#include "ardour/filesystem_paths.h"
+#include "canvas/item.h"
#include "ardour_ui.h"
#include "debug.h"
@@ -55,7 +54,6 @@
#include "utils.h"
#include "i18n.h"
#include "rgb_macros.h"
-#include "canvas_impl.h"
#include "gui_thread.h"
using namespace std;
@@ -202,18 +200,6 @@ xpm2rgba (const char** xpm, uint32_t& w, uint32_t& h)
return (savergb);
}
-ArdourCanvas::Points*
-get_canvas_points (string /*who*/, uint32_t npoints)
-{
- // cerr << who << ": wants " << npoints << " canvas points" << endl;
-#ifdef TRAP_EXCESSIVE_POINT_REQUESTS
- if (npoints > (uint32_t) gdk_screen_width() + 4) {
- abort ();
- }
-#endif
- return new ArdourCanvas::Points (npoints);
-}
-
Pango::FontDescription
get_font_for_style (string widgetname)
{
@@ -349,12 +335,6 @@ rgba_p_from_style (string style, float *r, float *g, float *b, string attr, int
return true;
}
-bool
-canvas_item_visible (ArdourCanvas::Item* item)
-{
- return (item->gobj()->object.flags & GNOME_CANVAS_ITEM_VISIBLE) ? true : false;
-}
-
void
set_color (Gdk::Color& c, int rgb)
{
@@ -588,7 +568,7 @@ get_xpm (std::string name)
{
if (!xpm_map[name]) {
- SearchPath spath(ARDOUR::ardour_data_search_path());
+ Searchpath spath(ARDOUR::ardour_data_search_path());
spath.add_subdirectory_to_paths("pixmaps");
@@ -614,7 +594,7 @@ get_icon_path (const char* cname)
string name = cname;
name += X_(".png");
- SearchPath spath(ARDOUR::ardour_data_search_path());
+ Searchpath spath(ARDOUR::ardour_data_search_path());
spath.add_subdirectory_to_paths("icons");
@@ -761,7 +741,9 @@ set_pango_fontsize ()
/* FT2 rendering - used by GnomeCanvas, sigh */
+#ifndef PLATFORM_WINDOWS
pango_ft2_font_map_set_resolution ((PangoFT2FontMap*) pango_ft2_font_map_new(), val/1024, val/1024);
+#endif
/* Cairo rendering, in case there is any */
@@ -829,15 +811,15 @@ unique_random_color (list<Gdk::Color>& used_colors)
while (1) {
- /* avoid neon/glowing tones by limiting them to the
- "inner section" (paler) of a color wheel/circle.
- */
+ double h, s, v;
- const int32_t max_saturation = 48000; // 65535 would open up the whole color wheel
+ h = fmod (random(), 360.0);
+ s = (random() % 65535) / 65535.0;
+ v = (random() % 65535) / 65535.0;
- newcolor.set_red (random() % max_saturation);
- newcolor.set_blue (random() % max_saturation);
- newcolor.set_green (random() % max_saturation);
+ s = min (0.5, s); /* not too saturated */
+ v = max (0.9, v); /* not too bright */
+ newcolor.set_hsv (h, s, v);
if (used_colors.size() == 0) {
used_colors.push_back (newcolor);
@@ -853,6 +835,7 @@ unique_random_color (list<Gdk::Color>& used_colors)
gdelta = newcolor.get_green() - c.get_green();
if (sqrt (rdelta*rdelta + bdelta*bdelta + gdelta*gdelta) > 25.0) {
+ /* different enough */
used_colors.push_back (newcolor);
return newcolor;
}