Replace several uses of GdkColor with Cairo::SolidPattern.
This commit is contained in:
parent
063e5887b4
commit
60ccdda018
8 changed files with 53 additions and 52 deletions
|
|
@ -95,6 +95,8 @@ gtk_gui_la_SOURCES = \
|
|||
$(lumigui_srcdir)/panels/timeline-panel.hpp \
|
||||
$(lumigui_srcdir)/panels/viewer-panel.cpp \
|
||||
$(lumigui_srcdir)/panels/viewer-panel.hpp \
|
||||
$(lumigui_srcdir)/util/cairo-util.cpp \
|
||||
$(lumigui_srcdir)/util/cairo-util.hpp \
|
||||
$(lumigui_srcdir)/util/convert.cpp \
|
||||
$(lumigui_srcdir)/util/convert.hpp \
|
||||
$(lumigui_srcdir)/util/rectangle.cpp \
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
/*
|
||||
<<<<<<< HEAD
|
||||
timeline.cpp - Implementation of the timeline widget
|
||||
|
||||
=======
|
||||
timeline-body.cpp - Implementation of the timeline body widget
|
||||
|
||||
>>>>>>> Fix several incorrect comments (refering to the wrong file).
|
||||
Copyright (C) Lumiera.org
|
||||
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
|
||||
|
||||
|
|
@ -31,6 +26,7 @@
|
|||
#include "timeline-body.hpp"
|
||||
#include "../timeline-widget.hpp"
|
||||
#include "../../window-manager.hpp"
|
||||
#include "../../util/cairo-util.hpp"
|
||||
|
||||
#include "timeline-arrow-tool.hpp"
|
||||
#include "timeline-ibeam-tool.hpp"
|
||||
|
|
@ -41,6 +37,8 @@ using namespace std;
|
|||
using namespace boost;
|
||||
using namespace lumiera;
|
||||
|
||||
using gui::util::CairoUtil;
|
||||
|
||||
namespace gui {
|
||||
namespace widgets {
|
||||
namespace timeline {
|
||||
|
|
@ -362,8 +360,8 @@ TimelineBody::draw_track(Cairo::RefPtr<Cairo::Context> cr,
|
|||
|
||||
// Draw the track background
|
||||
cr->rectangle(0, 0, view_width, height);
|
||||
GdkColor colour = backgroundColour; // Needed to preserve const qualifier
|
||||
gdk_cairo_set_source_color(cr->cobj(), &colour);
|
||||
Cairo::RefPtr<Cairo::SolidPattern> bg_col = backgroundColour; // Needed to preserve const qualifier
|
||||
cr->set_source(bg_col);
|
||||
cr->fill();
|
||||
|
||||
// Render the track
|
||||
|
|
@ -391,17 +389,13 @@ TimelineBody::draw_selection(Cairo::RefPtr<Cairo::Context> cr)
|
|||
// Draw the cover
|
||||
if(end_x > 0 && start_x < allocation.get_width())
|
||||
{
|
||||
cr->set_source_rgba(
|
||||
(float)selectionColour.red / 0xFFFF,
|
||||
(float)selectionColour.green / 0xFFFF,
|
||||
(float)selectionColour.blue / 0xFFFF,
|
||||
selectionAlpha);
|
||||
cr->set_source (CairoUtil::pattern_set_alpha (selectionColour, selectionAlpha));
|
||||
cr->rectangle(start_x + 0.5, 0,
|
||||
end_x - start_x, allocation.get_height());
|
||||
cr->fill();
|
||||
}
|
||||
|
||||
gdk_cairo_set_source_color(cr->cobj(), &selectionColour);
|
||||
cr->set_source(selectionColour);
|
||||
cr->set_line_width(1);
|
||||
|
||||
// Draw the start
|
||||
|
|
@ -440,7 +434,7 @@ TimelineBody::draw_playback_point(Cairo::RefPtr<Cairo::Context> cr)
|
|||
const int x = view_window().time_to_x(point);
|
||||
|
||||
// Set source
|
||||
gdk_cairo_set_source_color(cr->cobj(), &playbackPointColour);
|
||||
cr->set_source(playbackPointColour);
|
||||
cr->set_line_width(1);
|
||||
|
||||
// Draw
|
||||
|
|
|
|||
|
|
@ -183,10 +183,10 @@ private:
|
|||
int beginShiftVerticalOffset;
|
||||
|
||||
// Style properties
|
||||
GdkColor backgroundColour;
|
||||
GdkColor selectionColour;
|
||||
Cairo::RefPtr<Cairo::SolidPattern> backgroundColour;
|
||||
Cairo::RefPtr<Cairo::SolidPattern> selectionColour;
|
||||
float selectionAlpha;
|
||||
GdkColor playbackPointColour;
|
||||
Cairo::RefPtr<Cairo::SolidPattern> playbackPointColour;
|
||||
|
||||
gui::widgets::TimelineWidget &timelineWidget;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "timeline-ruler.hpp"
|
||||
#include "../timeline-widget.hpp"
|
||||
#include "../../window-manager.hpp"
|
||||
#include "../../util/cairo-util.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include "../../../lib/time.h"
|
||||
|
|
@ -39,6 +40,8 @@ using namespace gui::widgets;
|
|||
using namespace gui::widgets::timeline;
|
||||
using namespace lumiera;
|
||||
|
||||
using gui::util::CairoUtil;
|
||||
|
||||
namespace gui {
|
||||
namespace widgets {
|
||||
namespace timeline {
|
||||
|
|
@ -445,15 +448,11 @@ TimelineRuler::draw_playback_period(Cairo::RefPtr<Cairo::Context> cr,
|
|||
}
|
||||
|
||||
// Fill
|
||||
cr->set_source_rgba(
|
||||
(float)playbackPeriodArrowColour.red / 0xFFFF,
|
||||
(float)playbackPeriodArrowColour.green / 0xFFFF,
|
||||
(float)playbackPeriodArrowColour.blue / 0xFFFF,
|
||||
playbackPeriodArrowAlpha);
|
||||
cr->set_source (CairoUtil::pattern_set_alpha (playbackPeriodArrowColour, playbackPeriodArrowAlpha));
|
||||
cr->fill_preserve();
|
||||
|
||||
// Stroke
|
||||
gdk_cairo_set_source_color(cr->cobj(), &playbackPeriodArrowColour);
|
||||
cr->set_source(playbackPeriodArrowColour);
|
||||
cr->set_line_width(1);
|
||||
cr->stroke();
|
||||
}
|
||||
|
|
@ -481,15 +480,11 @@ TimelineRuler::draw_playback_point(Cairo::RefPtr<Cairo::Context> cr,
|
|||
cr->close_path();
|
||||
|
||||
// Fill
|
||||
cr->set_source_rgba(
|
||||
(float)playbackPointColour.red / 0xFFFF,
|
||||
(float)playbackPointColour.green / 0xFFFF,
|
||||
(float)playbackPointColour.blue / 0xFFFF,
|
||||
playbackPointAlpha);
|
||||
cr->set_source (CairoUtil::pattern_set_alpha (playbackPeriodArrowColour, playbackPeriodArrowAlpha));
|
||||
cr->fill_preserve();
|
||||
|
||||
// Stroke
|
||||
gdk_cairo_set_source_color(cr->cobj(), &playbackPointColour);
|
||||
cr->set_source(playbackPointColour);
|
||||
cr->set_line_width(1);
|
||||
cr->stroke();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -218,11 +218,11 @@ private:
|
|||
int mouseChevronSize;
|
||||
int selectionChevronSize;
|
||||
|
||||
GdkColor playbackPointColour;
|
||||
Cairo::RefPtr<Cairo::SolidPattern> playbackPointColour;
|
||||
float playbackPointAlpha;
|
||||
int playbackPointSize;
|
||||
|
||||
GdkColor playbackPeriodArrowColour;
|
||||
Cairo::RefPtr<Cairo::SolidPattern> playbackPeriodArrowColour;
|
||||
float playbackPeriodArrowAlpha;
|
||||
int playbackPeriodArrowSize;
|
||||
int playbackPeriodArrowStemSize;
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ WindowManager::on_window_closed(GdkEventAny* event)
|
|||
shared_ptr<WorkspaceWindow> workspace_window(*iterator);
|
||||
REQUIRE(workspace_window);
|
||||
|
||||
RefPtr<Gdk::Window> window = workspace_window->get_window();
|
||||
Glib::RefPtr<Gdk::Window> window = workspace_window->get_window();
|
||||
REQUIRE(window);
|
||||
if(window->gobj() == event->window)
|
||||
{
|
||||
|
|
@ -134,25 +134,33 @@ WindowManager::update_close_window_in_menus()
|
|||
}
|
||||
}
|
||||
|
||||
GdkColor
|
||||
WindowManager::read_style_colour_property(
|
||||
Cairo::RefPtr<Cairo::SolidPattern>
|
||||
WindowManager::read_style_colour_property (
|
||||
Gtk::Widget &widget, const gchar *property_name,
|
||||
guint16 red, guint16 green, guint16 blue)
|
||||
{
|
||||
GdkColor *colour;
|
||||
REQUIRE (property_name);
|
||||
|
||||
gtk_widget_style_get(widget.gobj(), property_name, &colour, NULL);
|
||||
// TODO: Can we get rid of the GdkColor completely here?
|
||||
GdkColor *color;
|
||||
gtk_widget_style_get(widget.gobj(), property_name, &color, NULL);
|
||||
|
||||
Cairo::RefPtr<Cairo::SolidPattern> pattern;
|
||||
// Did the color load successfully?
|
||||
if(colour != NULL)
|
||||
return *colour;
|
||||
if (color != NULL)
|
||||
{
|
||||
pattern = Cairo::SolidPattern::create_rgb ( (double)color->red / 0xFFFF,
|
||||
(double)color->green / 0xFFFF,
|
||||
(double)color->blue / 0xFFFF);
|
||||
}
|
||||
else
|
||||
{
|
||||
WARN(gui, "%s style value failed to load", property_name);
|
||||
|
||||
const GdkColor default_colour = {0, red, green, blue};
|
||||
return default_colour;
|
||||
}
|
||||
{
|
||||
WARN(gui, "%s style value failed to load", property_name);
|
||||
|
||||
pattern = Cairo::SolidPattern::create_rgb ( red, green, blue );
|
||||
}
|
||||
|
||||
return pattern;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -167,7 +175,7 @@ WindowManager::register_app_icon_sizes()
|
|||
void
|
||||
WindowManager::register_stock_items()
|
||||
{
|
||||
RefPtr<IconFactory> factory = IconFactory::create();
|
||||
Glib::RefPtr<IconFactory> factory = IconFactory::create();
|
||||
|
||||
add_stock_icon_set(factory, "panel-resources", "panel_resources", _("_Resources"));
|
||||
add_stock_icon_set(factory, "panel-timeline", "panel_timeline", _("_Timeline"));
|
||||
|
|
@ -256,7 +264,7 @@ WindowManager::add_theme_icon_source(Gtk::IconSet &icon_set,
|
|||
REQUIRE(width > 0);
|
||||
|
||||
// Try to load the icon
|
||||
RefPtr<Gtk::IconTheme> theme = Gtk::IconTheme::get_default();
|
||||
Glib::RefPtr<Gtk::IconTheme> theme = Gtk::IconTheme::get_default();
|
||||
REQUIRE(theme);
|
||||
|
||||
TODO ("find out how IconInfo could be made const. For example, GTKmm 2.10.10 is missing the const on operator bool() in iconinfo.h");
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
** @see gtk-lumiera.hpp
|
||||
*/
|
||||
|
||||
#include <cairomm/cairomm.h>
|
||||
|
||||
#include "gtk-lumiera.hpp"
|
||||
//#include "workspace/workspace-window.hpp"
|
||||
|
||||
|
|
@ -81,9 +83,9 @@ public:
|
|||
* @param blue The fallback blue intensity.
|
||||
* @return The loaded colour.
|
||||
**/
|
||||
static GdkColor read_style_colour_property(
|
||||
Gtk::Widget &widget, const gchar *property_name,
|
||||
guint16 red, guint16 green, guint16 blue);
|
||||
static Cairo::RefPtr<Cairo::SolidPattern>
|
||||
read_style_colour_property (Gtk::Widget &widget, const gchar *property_name,
|
||||
guint16 red, guint16 green, guint16 blue);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ Actions::Actions(WorkspaceWindow &workspace_window) :
|
|||
}
|
||||
|
||||
void
|
||||
Actions::populate_main_actions(RefPtr<Gtk::UIManager> uiManager)
|
||||
Actions::populate_main_actions(Glib::RefPtr<Gtk::UIManager> uiManager)
|
||||
{
|
||||
REQUIRE(uiManager);
|
||||
|
||||
|
|
@ -208,11 +208,11 @@ Actions::populate_main_actions(RefPtr<Gtk::UIManager> uiManager)
|
|||
}
|
||||
|
||||
void
|
||||
Actions::populate_show_panel_actions(RefPtr<Gtk::UIManager> uiManager)
|
||||
Actions::populate_show_panel_actions(Glib::RefPtr<Gtk::UIManager> uiManager)
|
||||
{
|
||||
const int count = PanelManager::get_panel_description_count();
|
||||
|
||||
RefPtr<Gtk::ActionGroup> actionGroup = ActionGroup::create();
|
||||
Glib::RefPtr<Gtk::ActionGroup> actionGroup = ActionGroup::create();
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
const gchar *stock_id = PanelManager::get_panel_stock_id(i);
|
||||
|
|
|
|||
Loading…
Reference in a new issue