Re: [LAD] C/gtk3/cairo meter widget

From: Tristan Matthews <le.businessman@email-addr-hidden>
Date: Thu Feb 14 2013 - 00:15:30 EET

2013/2/13 Patrick Shirkey <pshirkey@email-addr-hidden>:
>
> On Thu, February 14, 2013 3:43 am, Patrick Shirkey wrote:
>> On Tue, February 12, 2013 9:00 pm, SxDx wrote:
>>> On 02/12/2013 09:56 AM, Patrick Shirkey wrote:
>>>>
>>>> On Tue, February 12, 2013 3:50 am, Paul Davis wrote:
>>>>> On Mon, Feb 11, 2013 at 11:44 AM, Patrick Shirkey <
>>>>> pshirkey@email-addr-hidden> wrote:
>>>>>
>>>>>>
>>>>>> Thanks for the tip. Will save me some braincells.
>>>>>>
>>>>>> Found it here:
>>>>>>
>>>>>>
>>>>>> http://guitarix.sourcearchive.com/documentation/0.10.0-2/GtkFastMeter_8cpp-source.html
>>>>>>
>>>>>> http://guitarix.sourcearchive.com/documentation/0.10.0-2/GtkFastMeter_8h-source.html
>>>>>>
>>>>>
>>>>> the code in ardour3 doesn't use pixbufs and is entirely drawn directly
>>>>> with
>>>>> cairo. you may or may not care.
>>>>>
>>>>
>>>> It's a multistep process to get it all integrated. I couldn't find
>>>> anything specific online for making a custom widget with gtk3 so I have
>>>> copied the structure and methods from the gtkscale/gtkrange widgets.
>>>>
>>>> http://git.gnome.org/browse/gtk+/tree/gtk/gtkscale.c?h=gtk-3-6
>>>> http://git.gnome.org/browse/gtk+/tree/gtk/gtkrange.c?h=gtk-3-6
>>>>
>>>> I got it to the point where it the class is building and init() is
>>>> being
>>>> called but I am having a problem with assigning the correct TYPE for
>>>> GTK_METER and getting the draw/realize methods to fire.
>>>>
>>>> http://boosthardware.com/code/jamin/
>>>
>>> Can you provide a small main.c or something?
>>> All I see in there are static init functions never called.
>>>
>>
>> Yeah it's just the class, no wrapping.
>>
>> It can be called like this:
>>
>> GtkWidget *gtkmeter;
>> GtkAdjustment *adjustment = (GtkAdjustment*) gtk_adjustment_new(0.0, -40,
>> 6, 0.0, 0.0, 0.0);
>>
>> meter = gtk_meter_net(adjustment, GTK_METER_UP, 0. -40, 6);
>>
>>
>
>
> Turns out there were a couple of small items that needed to be changed. I
> had to disable the additional params in the call to g_object_new() in
> gtk_meter_init() and fix the Type Declaration.
>
> I have updated the files. http://boosthardware.com/code/jamin/
>
> At the moment I have a meter that doesn't update which shouldn't take long
> to fix. However what I am aiming for is to integrate the different cairo
> meters into one class.
>
> fastmeter - ardour
> vumeter - scenic
> GtkMeter - jackeq

I would recommend avoiding subclassing, if possible, and maybe install
a "render-style" property for your object which will determine which
drawing code to call. Maybe it's not as easy as that though.

Best,
Tristan

>
> Any ideas or suggestions on how to make that work for the GtkMeter class?
>
>
>
>
>
> --
> Patrick Shirkey
> Boost Hardware Ltd
> _______________________________________________
> Linux-audio-dev mailing list
> Linux-audio-dev@email-addr-hidden
> http://lists.linuxaudio.org/listinfo/linux-audio-dev

-- 
Tristan Matthews
web: http://tristanswork.blogspot.com
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Thu Feb 14 00:15:07 2013

This archive was generated by hypermail 2.1.8 : Thu Feb 14 2013 - 00:15:07 EET