|
From: amerke <art...@ud...> - 2020-08-02 23:15:10
|
sounds good, looking forward to GTK5 :-)
maybe i also get used to some unexpected(?) behaviour. consider the code:
require 'gtk3'
require 'cairo'
class ArtScrollCanvas < Gtk::Grid
def initialize
super
@user_zoom= 1.0
@darea = Gtk::DrawingArea.new
@darea.hexpand= true
@darea.vexpand= true
@darea.signal_connect('configure-event') do
print "\n darea_configure_callback"
update_adjustments_and_paint(0.0, 0.0)
end
@darea.signal_connect "draw" do |_, cr|
paint(cr)
end
attach(@darea, 0, 0, 1, 1)
update_adjustments_and_paint(0.0, 0.0)
end
def update_adjustments_and_paint(dx= 0.0, dy= 0.0)
@darea.queue_draw_area(0, 0, @darea.allocation.width,
@darea.allocation.height)
end
def paint(cr)
cr.set_source_rgba(1, 1, 1, 1)
cr.paint
#cr.save
#cr.restore
#cr.save
#m= Cairo::Matrix.new(1.0, 0.0, 0.0, 1.0, 300.0, 200.0)
m= Cairo::Matrix.new(1.0, 0.0, 0.0, 1.0, 300.0, 100.0)
cr.set_matrix(m)
cr.move_to(0.0, 0.0)
cr.line_to(100.0, 0.0)
cr.line_to(100.0, 100.0)
cr.line_to(0.0, 100.0)
cr.set_source_rgba(1.0, 0.0, 0.0, 1.0)
cr.fill
#cr.restore
end
end
class ArtApplicationWindow < Gtk::ApplicationWindow
def initialize(application)
super(application)
signal_connect('destroy') do
#Gtk.main_quit
application.quit
end
set_title 'Art'
set_size_request(600, 400)
@canvas = ArtScrollCanvas.new
@b1 = Gtk::Button.new(label: "New")
@b2 = Gtk::Button.new(label: "New")
@b3 = Gtk::Button.new(label: "New")
@vbox = Gtk::Box.new(:vertical, 0)
@vbox.pack_start(@b1, :expand => false, :fill => false, :padding => 0)
@vbox.pack_start(@b2, :expand => false, :fill => false, :padding => 0)
@vbox.pack_start(@b3, :expand => false, :fill => false, :padding => 0)
@vbox.pack_start(@canvas, :expand => true, :fill => true, :padding
=> 0)
add(@vbox)
show_all
end
end # ArtApplicationWindow
class ArtApp < Gtk::Application
def initialize
super("org.gtk.exampleapp", :handles_open)
signal_connect('activate') do |application|
window = ArtApplicationWindow.new(application)
window.present
end
end
end
app = ArtApp.new
app.run
the matrix seems to be applied with respect to the entire window but NOT
with respect to the DrawingArea (is much to high)
how do i use a cairo contex with matrix transformations with respect to
the DrawingArea itself?
i also curious why the buttons keep pressed/focused (it are normal
buttons, not togglebuttons)
cheers
artur
On 02.08.20 23:25, Sutou Kouhei wrote:
> Hi,
>
> In <8f6...@ud...>
> "Re: [ruby-gnome2-devel-en] problems with ruby/gtk/tcp" on Sun, 2 Aug 2020 17:57:59 +0200,
> amerke <art...@ud...> wrote:
>
>> thank you kou, this seems to work fine (but is not well documented :-(
>
> I hope that this GC related work is done without user
> code. But I don't have an idea for now. :<
> (The block of ss.signal_connect("incoming") doesn't refer
> local variables like the channel automatically.)
>
>> btw. just another question: what about the status of ruby and GTK
>> (ver. 4). is it going to be continued in the future?
>
> Yes.
> There is an implementation for Ruby/GTK4:
> https://github.com/ruby-gnome/ruby-gnome/tree/master/gtk4
> We'll release it when GTK 4 is released.
>
>> (the number of posts in this list is almost 0 :-)
>
> Recently, users use GitHub issues:
> https://github.com/ruby-gnome/ruby-gnome/issues?q=is%3Aissue+is%3Aclosed
>
>> also there are almost no ruby/GTK projects on github ...
>
> It seems there are 20+ projects that use Ruby/GTK3:
> https://rubygems.org/gems/gtk3/reverse_dependencies
>
>> earlier on i used qt4 but the support for qt4 was discontinued (no
>> qtbindungs for qt5) ... so i would like to know more about the future
>> of ruby/GTK. i think missing good ruby support for the two major
>> platforms (GTK/QT) is one of the reasons why ruby is staying behind
>> python, considering the number of (gui but also other) projects
>> etc. (at least outside of japan)
>
> We'll maintain Ruby/GTK4, Ruby/GTK5 and so on because we (at
> least me) will use them. :-)
>
>
> Thanks,
> --
> kou
>
>
> _______________________________________________
> ruby-gnome2-devel-en mailing list
> rub...@li...
> https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en
>
|