Ruby GTK3移行後のメインリポジトリ
リビジョン | a689d76504790521946f98ef88f6d553b7322ae8 (tree) |
---|---|
日時 | 2015-03-22 21:21:38 |
作者 | Shyouzou Sugitani <shy@user...> |
コミッター | Shyouzou Sugitani |
update error checking(3)
@@ -45,18 +45,16 @@ module Balloon | ||
45 | 45 | @parent = parent |
46 | 46 | end |
47 | 47 | |
48 | - def handle_request(event_type, event, *arglist, **argdict) | |
48 | + def handle_request(event_type, event, *arglist) | |
49 | 49 | #assert event_type in ['GET', 'NOTIFY'] |
50 | 50 | handlers = { |
51 | 51 | 'reset_user_interaction' => 'reset_user_interaction', |
52 | 52 | } |
53 | -# handler = handlers.get(event) | |
54 | -# if handler == nil | |
55 | 53 | if !handlers.include?(event) |
56 | 54 | result = @parent.handle_request( |
57 | - event_type, event, *arglist, **argdict) | |
55 | + event_type, event, *arglist) | |
58 | 56 | else |
59 | - result = handler(*arglist, **argdict) | |
57 | + result = handlers[event].call(*arglist) | |
60 | 58 | end |
61 | 59 | if event_type == 'GET' |
62 | 60 | return result |
@@ -142,7 +140,6 @@ module Balloon | ||
142 | 140 | communicate3 = nil |
143 | 141 | for key in balloon.keys |
144 | 142 | value = balloon[key] |
145 | -# for key, value in balloon.items() | |
146 | 143 | if ['arrow0', 'arrow1'].include?(key) |
147 | 144 | balloon0[key] = value |
148 | 145 | balloon1[key] = value |
@@ -182,7 +179,7 @@ module Balloon | ||
182 | 179 | end |
183 | 180 | |
184 | 181 | def add_window(side) |
185 | -# assert @window.length == side | |
182 | + #assert @window.length == side | |
186 | 183 | if side == 0 |
187 | 184 | name = 'balloon.sakura' |
188 | 185 | id_format = 's' |
@@ -198,8 +195,7 @@ module Balloon | ||
198 | 195 | end |
199 | 196 | gtk_window = create_gtk_window(name) |
200 | 197 | balloon_window = BalloonWindow.new( |
201 | - gtk_window, side, @desc, balloon, | |
202 | - id_format) | |
198 | + gtk_window, side, @desc, balloon, id_format) | |
203 | 199 | balloon_window.set_responsible(self) |
204 | 200 | @window << balloon_window |
205 | 201 | end |
@@ -569,7 +565,7 @@ module Balloon | ||
569 | 565 | @parent = parent |
570 | 566 | end |
571 | 567 | |
572 | -# @property | |
568 | + #@property | |
573 | 569 | def scale |
574 | 570 | scaling = @parent.handle_request('GET', 'get_preference', 'balloon_scaling') |
575 | 571 | scale = @parent.handle_request('GET', 'get_preference', 'surface_scale') |
@@ -580,12 +576,12 @@ module Balloon | ||
580 | 576 | end |
581 | 577 | end |
582 | 578 | |
583 | -# @property | |
579 | + #@property | |
584 | 580 | def direction |
585 | 581 | return @__direction |
586 | 582 | end |
587 | 583 | |
588 | -# @direction.setter | |
584 | + #@direction.setter | |
589 | 585 | def direction(direction) |
590 | 586 | if @__direction != direction |
591 | 587 | @__direction = direction # 0: left, 1: right |
@@ -658,7 +654,7 @@ module Balloon | ||
658 | 654 | |
659 | 655 | def reset_sstp_marker |
660 | 656 | if @side == 0 |
661 | -# assert @balloon_surface != nil | |
657 | + #assert @balloon_surface != nil | |
662 | 658 | w = @balloon_surface.width |
663 | 659 | h = @balloon_surface.height |
664 | 660 | # sstp marker position |
@@ -677,7 +673,7 @@ module Balloon | ||
677 | 673 | def reset_arrow |
678 | 674 | # arrow positions |
679 | 675 | @arrow = [] |
680 | -# assert @balloon_surface != nil | |
676 | + #assert @balloon_surface != nil | |
681 | 677 | w = @balloon_surface.width |
682 | 678 | h = @balloon_surface.height |
683 | 679 | x = config_adjust('arrow0.x', w, -10) |
@@ -767,7 +763,7 @@ module Balloon | ||
767 | 763 | def get_balloon_size(scaling=true) |
768 | 764 | w = @width |
769 | 765 | h = @height |
770 | -# scale = @scale | |
766 | + #scale = @scale | |
771 | 767 | if scaling |
772 | 768 | w = (w * scale / 100.0).to_i |
773 | 769 | h = (h * scale / 100.0).to_i |
@@ -787,13 +783,13 @@ module Balloon | ||
787 | 783 | balloon_id = @id_format + (0 + @__direction).to_i.to_s |
788 | 784 | @balloon_surface = get_image_surface(balloon_id) |
789 | 785 | end |
790 | -# assert @balloon_surface != nil | |
786 | + #assert @balloon_surface != nil | |
791 | 787 | @balloon_id = balloon_id |
792 | 788 | # change surface and window position |
793 | 789 | x, y = @position |
794 | 790 | @width = @balloon_surface.width |
795 | 791 | @height = @balloon_surface.height |
796 | -# scale = @scale | |
792 | + #scale = @scale | |
797 | 793 | w = (@width * scale / 100.0).to_i |
798 | 794 | h = (@height * scale / 100.0).to_i |
799 | 795 | @window.update_size(w, h) |
@@ -825,18 +821,6 @@ module Balloon | ||
825 | 821 | return value.to_i |
826 | 822 | end |
827 | 823 | |
828 | - def __get_with_type(name, conv, default_value) | |
829 | - path, config = @balloon[@balloon_id] | |
830 | - value = config.get_with_type(name, conv) | |
831 | - if value == nil | |
832 | - value = @desc.get_with_type(name, conv) | |
833 | - if value == nil | |
834 | - value = default_value | |
835 | - end | |
836 | - end | |
837 | - return conv(value) | |
838 | - end | |
839 | - | |
840 | 824 | def __get(name, default_value) |
841 | 825 | path, config = @balloon[@balloon_id] |
842 | 826 | value = config.get(name) |
@@ -849,18 +833,6 @@ module Balloon | ||
849 | 833 | return value |
850 | 834 | end |
851 | 835 | |
852 | -# def __get_with_scaling(name, conv, default_value) | |
853 | -# path, config = @balloon[@balloon_id] | |
854 | -# value = config.get_with_type(name, conv) | |
855 | -# if value == nil | |
856 | -# value = @desc.get_with_type(name, conv) | |
857 | -# if value == nil | |
858 | -# value = default_value | |
859 | -# end | |
860 | -# end | |
861 | -# return conv(value * scale / 100) | |
862 | -# end | |
863 | - | |
864 | 836 | def __get_with_scaling(name, default_value) |
865 | 837 | path, config = @balloon[@balloon_id] |
866 | 838 | value = config.get(name) |
@@ -910,11 +882,7 @@ module Balloon | ||
910 | 882 | end |
911 | 883 | |
912 | 884 | def is_shown |
913 | - if @__shown | |
914 | - return 1 | |
915 | - else | |
916 | - return 0 | |
917 | - end | |
885 | + return @__shown | |
918 | 886 | end |
919 | 887 | |
920 | 888 | def show |
@@ -960,15 +928,14 @@ module Balloon | ||
960 | 928 | end |
961 | 929 | @sstp_message = message.to_s + " (" + sender.to_s + ")" |
962 | 930 | x, y, w, h = @sstp_region |
963 | -# @sstp_layout.set_text(@sstp_message, -1) | |
964 | 931 | @sstp_layout.set_text(@sstp_message) |
965 | 932 | message_width, message_height = @sstp_layout.pixel_size |
966 | 933 | if message_width > w |
967 | - @sstp_message = '... ({0})'.format(sender) | |
934 | + @sstp_message = '... (' + sender + ')' | |
968 | 935 | i = 0 |
969 | 936 | while 1 |
970 | 937 | i += 1 |
971 | - s = '{0}... ({1})'.format(message[0, i], sender) | |
938 | + s = message[0, i] + '... (' + sender + ')' | |
972 | 939 | @sstp_layout.set_text(s, -1) |
973 | 940 | message_width, message_height = \ |
974 | 941 | @sstp_layout.get_pixel_size() |
@@ -999,13 +966,10 @@ module Balloon | ||
999 | 966 | end |
1000 | 967 | # draw sstp message |
1001 | 968 | x, y, w, h = @sstp_region |
1002 | -# @sstp_layout.set_text(@sstp_message, -1) | |
1003 | 969 | @sstp_layout.set_text(@sstp_message) |
1004 | 970 | cr.set_source_rgba(*@sstp_message_color) |
1005 | 971 | cr.move_to(x, y) |
1006 | 972 | cr.show_pango_layout(@sstp_layout) |
1007 | -# PangoCairo.update_layout(cr, @sstp_layout) | |
1008 | -# PangoCairo.show_layout(cr, @sstp_layout) | |
1009 | 973 | cr.restore() |
1010 | 974 | end |
1011 | 975 |
@@ -1134,8 +1098,6 @@ module Balloon | ||
1134 | 1098 | cr.set_source_rgba(*@text_normal_color) |
1135 | 1099 | cr.move_to(x, y) |
1136 | 1100 | cr.show_pango_layout(@layout) |
1137 | -# PangoCairo.update_layout(cr, @layout) | |
1138 | -# PangoCairo.show_layout(cr, @layout) | |
1139 | 1101 | if @sstp_surface != nil |
1140 | 1102 | for l, c in @sstp_marker |
1141 | 1103 | if l == i |
@@ -1221,8 +1183,7 @@ module Balloon | ||
1221 | 1183 | cr.fill() |
1222 | 1184 | cr.move_to(x, y) |
1223 | 1185 | cr.set_source_rgba(*@text_active_color) |
1224 | - PangoCairo.update_layout(cr, @layout) | |
1225 | - PangoCairo.show_layout(cr, @layout) | |
1186 | + cr.show_pango_layout(@layout) | |
1226 | 1187 | end |
1227 | 1188 | end |
1228 | 1189 | end |
@@ -1234,7 +1195,7 @@ module Balloon | ||
1234 | 1195 | for i in 0..(@link_buffer.length - 1) |
1235 | 1196 | sl = @link_buffer[i][0] |
1236 | 1197 | el = @link_buffer[i][2] |
1237 | - if @lineno <= sl <= @lineno + @lines | |
1198 | + if @lineno <= sl and sl <= @lineno + @lines | |
1238 | 1199 | sn = @link_buffer[i][1] |
1239 | 1200 | en = @link_buffer[i][3] |
1240 | 1201 | for n in sl..el |
@@ -1258,7 +1219,7 @@ module Balloon | ||
1258 | 1219 | @layout.set_markup(markup, -1) |
1259 | 1220 | text_w, text_h = @layout.get_pixel_size() |
1260 | 1221 | w = text_w |
1261 | - if x <= px < x + w and y <= py < y + h | |
1222 | + if x <= px and px < x + w and y <= py and py < y + h | |
1262 | 1223 | new_selection = i |
1263 | 1224 | break |
1264 | 1225 | end |
@@ -1270,8 +1231,8 @@ module Balloon | ||
1270 | 1231 | sl, sn, el, en, link_id, raw_text, text = \ |
1271 | 1232 | @link_buffer[new_selection] |
1272 | 1233 | @parent.handle_request( |
1273 | - 'NOTIFY', 'notify_event', | |
1274 | - 'OnChoiceEnter', raw_text, link_id, @selection) | |
1234 | + 'NOTIFY', 'notify_event', | |
1235 | + 'OnChoiceEnter', raw_text, link_id, @selection) | |
1275 | 1236 | end |
1276 | 1237 | else |
1277 | 1238 | if @selection != nil |
@@ -1290,9 +1251,9 @@ module Balloon | ||
1290 | 1251 | if event.hint? |
1291 | 1252 | _, x, y, state = widget.window.get_device_position(event.device) |
1292 | 1253 | else |
1293 | - x, y, state = event.x, event.y, event.get_state() | |
1254 | + x, y, state = event.x, event.y, event.state | |
1294 | 1255 | end |
1295 | -# scale = @scale | |
1256 | + #scale = @scale | |
1296 | 1257 | px, py = @window.winpos_to_surfacepos(x, y, scale) |
1297 | 1258 | if @link_buffer |
1298 | 1259 | if check_link_region(px, py) |
@@ -1300,7 +1261,7 @@ module Balloon | ||
1300 | 1261 | end |
1301 | 1262 | end |
1302 | 1263 | if not @parent.handle_request('GET', 'busy') |
1303 | - if state & Gdk.ModifierType.BUTTON1_MASK | |
1264 | + if (state & Gdk::Window::ModifierType::BUTTON1_MASK).nonzero? | |
1304 | 1265 | if @x_root != nil and \ |
1305 | 1266 | @y_root != nil |
1306 | 1267 | @dragged = true |
@@ -1309,8 +1270,8 @@ module Balloon | ||
1309 | 1270 | @x_fractions = x_delta - x_delta.to_i |
1310 | 1271 | @y_fractions = y_delta - y_delta.to_i |
1311 | 1272 | @parent.handle_request( |
1312 | - 'NOTIFY', 'update_balloon_offset', | |
1313 | - @side, x_delta.to_i, y_delta.to_i) | |
1273 | + 'NOTIFY', 'update_balloon_offset', | |
1274 | + @side, x_delta.to_i, y_delta.to_i) | |
1314 | 1275 | @x_root = event.x_root |
1315 | 1276 | @y_root = event.y_root |
1316 | 1277 | end |
@@ -1321,14 +1282,14 @@ module Balloon | ||
1321 | 1282 | |
1322 | 1283 | def scroll(darea, event) |
1323 | 1284 | px, py = @window.winpos_to_surfacepos( |
1324 | - event.x.to_i, event.y.to_i, scale) | |
1325 | - if event.direction == Gdk.ScrollDirection.UP | |
1285 | + event.x.to_i, event.y.to_i, scale) | |
1286 | + if event.direction == Gdk::EventScroll::UP | |
1326 | 1287 | if @lineno > 0 |
1327 | 1288 | @lineno = [@lineno - 2, 0].max |
1328 | 1289 | check_link_region(px, py) |
1329 | 1290 | @darea.queue_draw() |
1330 | 1291 | end |
1331 | - elsif event.direction == Gdk.ScrollDirection.DOWN | |
1292 | + elsif event.direction == Gdk::EventScroll::DOWN | |
1332 | 1293 | if @lineno + @lines < @text_buffer.length |
1333 | 1294 | @lineno = [@lineno + 2, |
1334 | 1295 | @text_buffer.length - @lines].min |
@@ -1353,12 +1314,12 @@ module Balloon | ||
1353 | 1314 | end |
1354 | 1315 | # arrows |
1355 | 1316 | px, py = @window.winpos_to_surfacepos( |
1356 | - event.x.to_i, event.y.to_i, scale) | |
1317 | + event.x.to_i, event.y.to_i, scale) | |
1357 | 1318 | # up arrow |
1358 | 1319 | w = @arrow0_surface.get_width() |
1359 | 1320 | h = @arrow0_surface.get_height() |
1360 | 1321 | x, y = @arrow[0] |
1361 | - if x <= px <= x + w and y <= py <= y + h | |
1322 | + if x <= px and px <= x + w and y <= py and py <= y + h | |
1362 | 1323 | if @lineno > 0 |
1363 | 1324 | @lineno = [@lineno - 2, 0].max |
1364 | 1325 | @darea.queue_draw() |
@@ -1369,7 +1330,7 @@ module Balloon | ||
1369 | 1330 | w = @arrow1_surface.get_width() |
1370 | 1331 | h = @arrow1_surface.get_height() |
1371 | 1332 | x, y = @arrow[1] |
1372 | - if x <= px <= x + w and y <= py <= y + h | |
1333 | + if x <= px and px <= x + w and y <= py and py <= y + h | |
1373 | 1334 | if @lineno + @lines < @text_buffer.length |
1374 | 1335 | @lineno = [@lineno + 2, |
1375 | 1336 | @text_buffer.length - @lines].min |
@@ -1395,7 +1356,7 @@ module Balloon | ||
1395 | 1356 | |
1396 | 1357 | def button_release(window, event) |
1397 | 1358 | x, y = @window.winpos_to_surfacepos( |
1398 | - event.x.to_i, event.y.to_i, scale) | |
1359 | + event.x.to_i, event.y.to_i, scale) | |
1399 | 1360 | if @dragged |
1400 | 1361 | @dragged = false |
1401 | 1362 | end |
@@ -1582,7 +1543,7 @@ module Balloon | ||
1582 | 1543 | return |
1583 | 1544 | end |
1584 | 1545 | line = @text_buffer.length - 1 |
1585 | - if @lineno <= line && line < @lineno + @lines | |
1546 | + if @lineno <= line and line < @lineno + @lines | |
1586 | 1547 | x, y, w, h = @line_regions[line - @lineno] |
1587 | 1548 | if @text_buffer[line].end_with?('\n[half]') |
1588 | 1549 | offset = line - @lineno + 1 |
@@ -1654,10 +1615,10 @@ module Balloon | ||
1654 | 1615 | drag_data_received(w, e) |
1655 | 1616 | end |
1656 | 1617 | # DnD data types |
1657 | -# dnd_targets = [Gtk.TargetEntry.new('text/plain', 0, 0)] | |
1658 | -# @window.drag_dest_set(Gtk.DestDefaults.ALL, dnd_targets, | |
1659 | -# Gdk.DragAction.COPY) | |
1660 | -# @window.drag_dest_add_text_targets() | |
1618 | + dnd_targets = [['text/plain', 0, 0]] | |
1619 | + @window.drag_dest_set(Gtk::Drag::DestDefaults::ALL, dnd_targets, | |
1620 | + Gdk::DragContext::Action::COPY) | |
1621 | + @window.drag_dest_add_text_targets() | |
1661 | 1622 | @window.set_events(Gdk::Event::BUTTON_PRESS_MASK) |
1662 | 1623 | @window.set_modal(true) |
1663 | 1624 | @window.set_window_position(Gtk::Window::Position::CENTER) |
@@ -1709,7 +1670,7 @@ module Balloon | ||
1709 | 1670 | else |
1710 | 1671 | box = Gtk::HBox.new(spacing=10) |
1711 | 1672 | box.set_border_width(10) |
1712 | - if ENTRY | |
1673 | + if not ENTRY.empty? | |
1713 | 1674 | label = Gtk::Label.new(label=ENTRY) |
1714 | 1675 | box.pack_start(label, false, true, 0) |
1715 | 1676 | label.show() |
@@ -1726,15 +1687,25 @@ module Balloon | ||
1726 | 1687 | |
1727 | 1688 | def redraw(widget, cr, surface) |
1728 | 1689 | cr.set_source_surface(surface, 0, 0) |
1729 | - cr.set_operator(cairo.OPERATOR_SOURCE) | |
1690 | + cr.set_operator(Cairo::OPERATOR_SOURCE) | |
1730 | 1691 | cr.paint() |
1731 | - region = Gdk.cairo_region_create_from_surface(cr.get_target()) | |
1692 | + w, h = @window.size | |
1693 | + image_surface = cr.target.map_to_image | |
1694 | + region = Cairo::Region.new() | |
1695 | + data = image_surface.data | |
1696 | + for i in 0..(data.size / 4 - 1) | |
1697 | + if (data[i * 4 + 3].ord) != 0 | |
1698 | + x = i % image_surface.width | |
1699 | + y = i / image_surface.width | |
1700 | + region.union!(x, y, 1, 1) | |
1701 | + end | |
1702 | + end | |
1732 | 1703 | # XXX: to avoid losing focus in the text input region |
1733 | 1704 | x = @entry.get_margin_left() |
1734 | 1705 | y = @entry.get_margin_top() |
1735 | 1706 | w = @entry.get_allocated_width() |
1736 | 1707 | h = @entry.get_allocated_height() |
1737 | - region.union(cairo.RectangleInt(x, y, w, h)) | |
1708 | + region.union!(x, y, w, h) | |
1738 | 1709 | @window.input_shape_combine_region(region) |
1739 | 1710 | end |
1740 | 1711 |
@@ -1752,7 +1723,7 @@ module Balloon | ||
1752 | 1723 | end |
1753 | 1724 | |
1754 | 1725 | def key_press(widget, event) |
1755 | - if event.keyval == Gdk.KEY_Escape | |
1726 | + if event.keyval == Gdk::Keyval::GDK_KEY_Escape | |
1756 | 1727 | @window.hide() |
1757 | 1728 | cancel() |
1758 | 1729 | return true |
@@ -1763,8 +1734,8 @@ module Balloon | ||
1763 | 1734 | def button_press(widget, event) |
1764 | 1735 | if [1, 2].include?(event.button) |
1765 | 1736 | @window.begin_move_drag( |
1766 | - event.button, event.x_root.to_i, event.y_root.to_i, | |
1767 | - Gtk.get_current_event_time()) | |
1737 | + event.button, event.x_root.to_i, event.y_root.to_i, | |
1738 | + Gtk.current_event_time()) | |
1768 | 1739 | end |
1769 | 1740 | return true |
1770 | 1741 | end |
@@ -1780,14 +1751,14 @@ module Balloon | ||
1780 | 1751 | @window.show() |
1781 | 1752 | end |
1782 | 1753 | |
1783 | -# @abc.abstractmethod | |
1754 | + #@abc.abstractmethod | |
1784 | 1755 | def enter |
1785 | -# pass | |
1756 | + #pass | |
1786 | 1757 | end |
1787 | 1758 | |
1788 | -# @abc.abstractmethod | |
1759 | + #@abc.abstractmethod | |
1789 | 1760 | def cancel |
1790 | -# pass | |
1761 | + #pass | |
1791 | 1762 | end |
1792 | 1763 | end |
1793 | 1764 |
@@ -1810,7 +1781,7 @@ module Balloon | ||
1810 | 1781 | end |
1811 | 1782 | |
1812 | 1783 | def key_press(widget, event) |
1813 | - if event.keyval == Gdk.KEY_Escape | |
1784 | + if event.keyval == Gdk::Keyval::GDK_KEY_Escape | |
1814 | 1785 | @window.hide() |
1815 | 1786 | cancel() |
1816 | 1787 | @parent.handle_request('NOTIFY', 'reset_user_interaction') |
@@ -16,19 +16,6 @@ module NConfig | ||
16 | 16 | |
17 | 17 | class Config < Hash |
18 | 18 | |
19 | - def get_with_type(name, conv, default=nil) | |
20 | - value = self.get(name) | |
21 | - if value == nil | |
22 | - return default | |
23 | - end | |
24 | - ##assert conv is not None | |
25 | - begin | |
26 | - return conv(value) | |
27 | - rescue | |
28 | - return default # XXX | |
29 | - end | |
30 | - end | |
31 | - | |
32 | 19 | def get(name, default=nil) |
33 | 20 | if name.class == Array |
34 | 21 | keylist = name |
@@ -42,11 +29,6 @@ module NConfig | ||
42 | 29 | end |
43 | 30 | return default |
44 | 31 | end |
45 | - | |
46 | -# def __str__ | |
47 | -# return ''.join( | |
48 | -# ['{0},{1}\n'.format(key, value) for key, value in self.items()]) | |
49 | -# end | |
50 | 32 | end |
51 | 33 | |
52 | 34 | def self.create_from_file(path) |
@@ -181,7 +181,7 @@ module Home | ||
181 | 181 | next |
182 | 182 | end |
183 | 183 | if balloon_info.include?('balloon_dir') # XXX |
184 | - logging.warninig('Oops: balloon id confliction') | |
184 | + #logging.warninig('Oops: balloon id confliction') | |
185 | 185 | next |
186 | 186 | else |
187 | 187 | balloon_info['balloon_dir'] = [subdir, NConfig.null_config()] |
@@ -325,7 +325,7 @@ module Home | ||
325 | 325 | end |
326 | 326 | line = line.encode('UTF-8', :invalid => :replace) |
327 | 327 | if not line.include?('=') |
328 | - error = 'line {0:d}: syntax error'.format(lineno) | |
328 | + error = 'line ' + lineno.to_s + ': syntax error' | |
329 | 329 | break |
330 | 330 | end |
331 | 331 | x = line.split('=', 2) |
@@ -341,7 +341,7 @@ module Home | ||
341 | 341 | kinoko[name] = value.to_i |
342 | 342 | end |
343 | 343 | if error |
344 | - logging.error('Error: {0}\n{1} (skipped)'.format(error, path)) | |
344 | + #logging.error('Error: {0}\n{1} (skipped)'.format(error, path)) | |
345 | 345 | return nil |
346 | 346 | end |
347 | 347 | end |
@@ -669,7 +669,7 @@ module Home | ||
669 | 669 | begin |
670 | 670 | charset = temp.split(',', 2)[1].strip().force_encoding('ascii') |
671 | 671 | rescue #except: |
672 | - pass | |
672 | + #pass | |
673 | 673 | end |
674 | 674 | next |
675 | 675 | end |
@@ -687,8 +687,7 @@ module Home | ||
687 | 687 | buf << temp[0, temp.length - 2] |
688 | 688 | end |
689 | 689 | if not opened |
690 | - logging.error( | |
691 | - 'syntax error: unbalnced "}" in surfaces.txt.') | |
690 | + #logging.error('syntax error: unbalnced "}" in surfaces.txt.') | |
692 | 691 | end |
693 | 692 | match = re_alias.match(key) |
694 | 693 | if match |
@@ -702,7 +701,7 @@ module Home | ||
702 | 701 | begin |
703 | 702 | key = key[0, -10] |
704 | 703 | rescue #except: |
705 | - pass | |
704 | + #pass | |
706 | 705 | end |
707 | 706 | value = {} |
708 | 707 | for line in buf |
@@ -722,13 +721,13 @@ module Home | ||
722 | 721 | begin |
723 | 722 | key = [key[0, 7], key[7, key.length - 1].to_i.to_s].join('') |
724 | 723 | rescue #except ValueError: |
725 | - pass | |
724 | + #pass | |
726 | 725 | end |
727 | 726 | else |
728 | 727 | begin |
729 | 728 | key = ['surface', key.to_i.to_s].join('') |
730 | 729 | rescue #except ValueError: |
731 | - pass | |
730 | + #pass | |
732 | 731 | end |
733 | 732 | end |
734 | 733 | config_list << [key, NConfig.create_from_buffer(buf, charset)] |
@@ -769,8 +768,8 @@ module Home | ||
769 | 768 | x = x.to_i |
770 | 769 | y = y.to_i |
771 | 770 | rescue #except ValueError: |
772 | - logging.error( | |
773 | - 'invalid element spec for {0}: {1}'.format(key, config[key])) | |
771 | + #logging.error( | |
772 | + # 'invalid element spec for {0}: {1}'.format(key, config[key])) | |
774 | 773 | next |
775 | 774 | end |
776 | 775 | buf << [key, method, filename, x, y] |
@@ -44,12 +44,12 @@ module Kinoko | ||
44 | 44 | EOS |
45 | 45 | @__menu_list = { |
46 | 46 | 'settings' => [['Settings', nil, _('Settings...(_O)'), nil, |
47 | - '', lambda {|a, b| return @parent.handle_request('NOTIFY', 'edit_preferences')}], | |
47 | + '', lambda {|a, b| @parent.handle_request('NOTIFY', 'edit_preferences')}], | |
48 | 48 | '/ui/popup/Settings'], |
49 | 49 | 'skin' => [['Skin', nil, _('Skin(_K)'), nil], |
50 | 50 | nil, '/ui/popup/Skin'], |
51 | 51 | 'exit' => [['Exit', nil, _('Exit(_Q)'), nil, |
52 | - '', lambda {|a, b| return @parent.handle_request('NOTIFY', 'close')}], | |
52 | + '', lambda {|a, b| @parent.handle_request('NOTIFY', 'close')}], | |
53 | 53 | '/ui/popup/Exit'], |
54 | 54 | } |
55 | 55 | actions = Gtk::ActionGroup.new('Actions') |
@@ -155,7 +155,7 @@ module Kinoko | ||
155 | 155 | @skin.set_position() ## FIXME |
156 | 156 | end |
157 | 157 | else |
158 | - ##logging.debug('OBSERVER(kinoko): ignore - {0}'.format(event)) | |
158 | + #logging.debug('OBSERVER(kinoko): ignore - {0}'.format(event)) | |
159 | 159 | end |
160 | 160 | end |
161 | 161 |
@@ -158,7 +158,7 @@ module Nekodorif | ||
158 | 158 | elsif event == 'finalize' |
159 | 159 | finalize() |
160 | 160 | else |
161 | - ##logging.debug('OBSERVER(nekodorif): ignore - {0}'.format(event)) | |
161 | + #logging.debug('OBSERVER(nekodorif): ignore - {0}'.format(event)) | |
162 | 162 | end |
163 | 163 | end |
164 | 164 |
@@ -103,12 +103,12 @@ module Seriko | ||
103 | 103 | @prev_tick = current_tick |
104 | 104 | update_frame(window) |
105 | 105 | if @dirty |
106 | - @dirty = false | |
107 | 106 | window.update_frame_buffer() |
107 | + @dirty = false | |
108 | 108 | end |
109 | 109 | if @move != nil |
110 | - @move = nil | |
111 | 110 | window.move_surface(*@move) |
111 | + @move = nil | |
112 | 112 | end |
113 | 113 | @timeout_id = GLib::Timeout.add((1000.0 / @fps).to_i) { update(window) } # [msec] |
114 | 114 | return false |
@@ -15,6 +15,7 @@ | ||
15 | 15 | |
16 | 16 | require "gtk3" |
17 | 17 | |
18 | +require "ninix/keymap" | |
18 | 19 | require "ninix/pix" |
19 | 20 | require "ninix/seriko" |
20 | 21 |
@@ -34,20 +35,19 @@ module Surface | ||
34 | 35 | @parent = parent |
35 | 36 | end |
36 | 37 | |
37 | - def handle_request(event_type, event, *arglist, **argdict) | |
38 | + def handle_request(event_type, event, *arglist) | |
38 | 39 | ##assert ['GET', 'NOTIFY'].include?(event_type) |
39 | 40 | handlers = { |
40 | 41 | 'stick_window' => 'window_stick', |
41 | 42 | } |
42 | 43 | if handlers.include?(event) |
43 | - result = handlers[event].call #( *arglist, **argdict) | |
44 | + result = handlers[event].call # no argument | |
44 | 45 | else |
45 | -# handler = handlers.get(event, getattr(self, event, None)) | |
46 | -# if handler == nil | |
47 | - result = @parent.handle_request( | |
48 | - event_type, event, *arglist, **argdict) | |
49 | -# else | |
50 | -# result = handler(*arglist, **argdict) | |
46 | + if Surface.method_defined?(event) | |
47 | + result = method(event).call(*arglist) | |
48 | + else | |
49 | + result = @parent.handle_request(event_type, event, *arglist) | |
50 | + end | |
51 | 51 | end |
52 | 52 | if event_type == 'GET' |
53 | 53 | return result |
@@ -103,8 +103,8 @@ module Surface | ||
103 | 103 | |
104 | 104 | def window_iconify(flag) |
105 | 105 | gtk_window = @window[0].window |
106 | - iconified = gtk_window.window.state & \ | |
107 | - Gdk::EventWindowState::ICONIFIED | |
106 | + iconified = (gtk_window.window.state & \ | |
107 | + Gdk::EventWindowState::ICONIFIED).nonzero? | |
108 | 108 | if flag and not iconified |
109 | 109 | gtk_window.iconify() |
110 | 110 | elsif not flag and iconified |
@@ -116,18 +116,18 @@ module Surface | ||
116 | 116 | if not @parent.handle_request('GET', 'is_running') |
117 | 117 | return |
118 | 118 | end |
119 | - if not (event.changed_mask & Gdk::EventWindowState::ICONIFIED) | |
119 | + if (event.changed_mask & Gdk::EventWindowState::ICONIFIED).zero? | |
120 | 120 | return |
121 | 121 | end |
122 | - if event.new_window_state & Gdk::EventWindowState::ICONIFIED | |
122 | + if (event.new_window_state & Gdk::EventWindowState::ICONIFIED).nonzero? | |
123 | 123 | if window == @window[0].get_window |
124 | 124 | @parent.handle_request('NOTIFY', 'notify_iconified') |
125 | 125 | end |
126 | 126 | for surface_window in @window |
127 | 127 | gtk_window = surface_window.get_window |
128 | 128 | if gtk_window != window and \ |
129 | - not gtk_window.window.state & \ | |
130 | - Gdk::EventWindowState::ICONIFIED | |
129 | + (gtk_window.window.state & \ | |
130 | + Gdk::EventWindowState::ICONIFIED).nonzero? | |
131 | 131 | gtk_window.iconify() |
132 | 132 | end |
133 | 133 | end |
@@ -135,8 +135,8 @@ module Surface | ||
135 | 135 | for surface_window in @window |
136 | 136 | gtk_window = surface_window.get_window |
137 | 137 | if gtk_window != window and \ |
138 | - gtk_window.window.state & \ | |
139 | - Gdk::EventWindowState::ICONIFIED | |
138 | + (gtk_window.window.state & \ | |
139 | + Gdk::EventWindowState::ICONIFIED).nonzero? | |
140 | 140 | gtk_window.deiconify() |
141 | 141 | end |
142 | 142 | end |
@@ -152,24 +152,25 @@ module Surface | ||
152 | 152 | end |
153 | 153 | |
154 | 154 | def key_press(window, event) |
155 | - name = @keymap_old.get(event.keyval, event.string) | |
156 | - keycode = @keymap_new.get(event.keyval, event.string) | |
157 | - if event.type == Gdk.EventType.KEY_RELEASE | |
155 | + name = Keymap::Keymap_old[event.keyval] | |
156 | + keycode = Keymap::Keymap_new[event.keyval] | |
157 | + if event.event_type == Gdk::Event::KEY_RELEASE | |
158 | 158 | @key_press_count = 0 |
159 | 159 | return true |
160 | 160 | end |
161 | - if not (event.type == Gdk.EventType.KEY_PRESS) | |
161 | + if not (event.event_type == Gdk::Event::KEY_PRESS) | |
162 | 162 | return false |
163 | 163 | end |
164 | 164 | @key_press_count += 1 |
165 | - if event.state & \ | |
166 | - (Gdk::Window::ModifierType::CONTROL_MASK | Gdk::Window::ModifierType::SHIFT_MASK) | |
165 | + if (event.state & \ | |
166 | + (Gdk::Window::ModifierType::CONTROL_MASK | \ | |
167 | + Gdk::Window::ModifierType::SHIFT_MASK)).nonzero? | |
167 | 168 | if name == 'f12' |
168 | - logging.info('reset surface position') | |
169 | + #logging.info('reset surface position') | |
169 | 170 | reset_position() |
170 | 171 | end |
171 | 172 | if name == 'f10' |
172 | - logging.info('reset balloon offset') | |
173 | + #logging.info('reset balloon offset') | |
173 | 174 | for side in 0..@window.length-1 |
174 | 175 | set_balloon_offset(side, nil) |
175 | 176 | end |
@@ -177,8 +178,8 @@ module Surface | ||
177 | 178 | end |
178 | 179 | if name or keycode |
179 | 180 | @parent.handle_request( |
180 | - 'NOTIFY', 'notify_event', 'OnKeyPress', name, keycode, | |
181 | - @key_press_count) | |
181 | + 'NOTIFY', 'notify_event', 'OnKeyPress', name, keycode, | |
182 | + @key_press_count) | |
182 | 183 | end |
183 | 184 | return true |
184 | 185 | end |
@@ -193,16 +194,12 @@ module Surface | ||
193 | 194 | end |
194 | 195 | end |
195 | 196 | |
196 | - #re_surface_id = re.compile('^surface([0-9]+)$') | |
197 | - #RE_SURFACE_ID = re.compile('^surface([0-9]+)$') | |
198 | 197 | RE_SURFACE_ID = Regexp.new('^surface([0-9]+)$') |
199 | 198 | |
200 | 199 | def get_seriko(surface) |
201 | 200 | seriko = {} |
202 | 201 | for basename in surface.keys |
203 | 202 | path, config = surface[basename] |
204 | -# for basename, (path, config) in surface.items() | |
205 | - #match = re_surface_id.match(basename) | |
206 | 203 | match = RE_SURFACE_ID.match(basename) |
207 | 204 | if not match |
208 | 205 | next |
@@ -236,7 +233,6 @@ module Surface | ||
236 | 233 | maxheight = 0 |
237 | 234 | for basename in surface.keys |
238 | 235 | path, config = surface[basename] |
239 | -# for basename, (path, config) in surface.items() | |
240 | 236 | if path == nil |
241 | 237 | next |
242 | 238 | end |
@@ -247,9 +243,8 @@ module Surface | ||
247 | 243 | if not File.exists?(dgp_path) |
248 | 244 | ddp_path = [name, '.ddp'].join('') |
249 | 245 | if not File.exists?(ddp_path) |
250 | -# logging.error( | |
251 | -# '{0}: file not found (ignored)'.format(path)) | |
252 | - print(path + ': file not found (ignored)' + "\n") | |
246 | + #logging.error( | |
247 | + # '{0}: file not found (ignored)'.format(path)) | |
253 | 248 | next |
254 | 249 | else |
255 | 250 | path = ddp_path |
@@ -262,7 +257,6 @@ module Surface | ||
262 | 257 | w, h = Pix.get_png_size(path) |
263 | 258 | maxwidth = [maxwidth, w].max |
264 | 259 | maxheight = [maxheight, h].max |
265 | - #match = re_surface_id.match(basename) | |
266 | 260 | match = RE_SURFACE_ID.match(basename) |
267 | 261 | if not match |
268 | 262 | next |
@@ -274,16 +268,13 @@ module Surface | ||
274 | 268 | composite_surface = {} |
275 | 269 | for basename in surface.keys |
276 | 270 | path, config = surface[basename] |
277 | -# for basename, (path, config) in surface.items() | |
278 | - #match = re_surface_id.match(basename) | |
279 | 271 | match = RE_SURFACE_ID.match(basename) |
280 | 272 | if not match |
281 | 273 | next |
282 | 274 | end |
283 | 275 | key = match[1] |
284 | 276 | if config.include?('element0') |
285 | -# logging.debug('surface {0}'.format(key)) | |
286 | - print('surface ' + key.to_s, "\n") | |
277 | + #logging.debug('surface {0}'.format(key)) | |
287 | 278 | composite_surface[key] = compose_elements(elements, config) |
288 | 279 | end |
289 | 280 | end |
@@ -292,7 +283,7 @@ module Surface | ||
292 | 283 | for key in [default_sakura, default_kero] |
293 | 284 | if not surfaces.include?(key.to_s) |
294 | 285 | raise SystemExit( |
295 | - 'cannot load default surface #' + key.to_s + ' (abort)\n') | |
286 | + 'cannot load default surface #' + key.to_s + ' (abort)\n') | |
296 | 287 | end |
297 | 288 | end |
298 | 289 | @__surfaces = surfaces |
@@ -300,8 +291,6 @@ module Surface | ||
300 | 291 | region = {} |
301 | 292 | for basename in surface.keys |
302 | 293 | path, config = surface[basename] |
303 | -# for basename, (path, config) in surface.items() | |
304 | - #match = re_surface_id.match(basename) | |
305 | 294 | match = RE_SURFACE_ID.match(basename) |
306 | 295 | if not match |
307 | 296 | next |
@@ -320,12 +309,10 @@ module Surface | ||
320 | 309 | next |
321 | 310 | end |
322 | 311 | begin |
323 | - for value in values[0, 4] | |
324 | - x1 = value[0].to_i | |
325 | - y1 = value[1].to_i | |
326 | - x2 = value[2].to_i | |
327 | - y2 = value[3].to_i | |
328 | - end | |
312 | + x1 = values[0].to_i | |
313 | + y1 = values[1].to_i | |
314 | + x2 = values[2].to_i | |
315 | + y2 = values[3].to_i | |
329 | 316 | rescue # except ValueError: |
330 | 317 | next |
331 | 318 | end |
@@ -338,14 +325,13 @@ module Surface | ||
338 | 325 | next |
339 | 326 | end |
340 | 327 | begin |
341 | - for value in rect.split(',') | |
342 | - x1 = value[0].to_i | |
343 | - y1 = value[1].to_i | |
344 | - x2 = value[2].to_i | |
345 | - y2 = value[3].to_i | |
346 | - end | |
328 | + values = rect.split(',') | |
329 | + x1 = values[0].to_i | |
330 | + y1 = values[1].to_i | |
331 | + x2 = values[2].to_i | |
332 | + y2 = values[3].to_i | |
347 | 333 | rescue # except ValueError: |
348 | - pass | |
334 | + #pass | |
349 | 335 | end |
350 | 336 | buf << [part.capitalize(), x1, y1, x2, y2].join('') |
351 | 337 | end |
@@ -356,8 +342,6 @@ module Surface | ||
356 | 342 | mayuna = {} |
357 | 343 | for basename in surface.keys |
358 | 344 | path, config = surface[basename] |
359 | -# for basename, (path, config) in surface.items() | |
360 | - #match = re_surface_id.match(basename) | |
361 | 345 | match = RE_SURFACE_ID.match(basename) |
362 | 346 | if not match |
363 | 347 | next |
@@ -409,22 +393,16 @@ module Surface | ||
409 | 393 | end |
410 | 394 | |
411 | 395 | def get_menu_fontcolor |
412 | - fontcolor_r = @desc.get_with_type( | |
413 | - 'menu.background.font.color.r', int, 0) | |
414 | - fontcolor_g = @desc.get_with_type( | |
415 | - 'menu.background.font.color.g', int, 0) | |
416 | - fontcolor_b = @desc.get_with_type( | |
417 | - 'menu.background.font.color.b', int, 0) | |
396 | + fontcolor_r = @desc.get('menu.background.font.color.r', 0).to_i | |
397 | + fontcolor_g = @desc.get('menu.background.font.color.g', 0).to_i | |
398 | + fontcolor_b = @desc.get('menu.background.font.color.b', 0).to_i | |
418 | 399 | fontcolor_r = [0, [255, fontcolor_r].min].max |
419 | 400 | fontcolor_g = [0, [255, fontcolor_g].min].max |
420 | 401 | fontcolor_b = [0, [255, fontcolor_b].min].max |
421 | 402 | background = [fontcolor_r, fontcolor_g, fontcolor_b] |
422 | - fontcolor_r = @desc.get_with_type( | |
423 | - 'menu.foreground.font.color.r', int, 0) | |
424 | - fontcolor_g = @desc.get_with_type( | |
425 | - 'menu.foreground.font.color.g', int, 0) | |
426 | - fontcolor_b = @desc.get_with_type( | |
427 | - 'menu.foreground.font.color.b', int, 0) | |
403 | + fontcolor_r = @desc.get('menu.foreground.font.color.r', 0).to_i | |
404 | + fontcolor_g = @desc.get('menu.foreground.font.color.g', 0).to_i | |
405 | + fontcolor_b = @desc.get('menu.foreground.font.color.b', 0).to_i | |
428 | 406 | fontcolor_r = [0, [255, fontcolor_r].min].max |
429 | 407 | fontcolor_g = [0, [255, fontcolor_g].min].max |
430 | 408 | fontcolor_b = [0, [255, fontcolor_b].min].max |
@@ -455,9 +433,9 @@ module Surface | ||
455 | 433 | bind = {} |
456 | 434 | for index in 0..127 |
457 | 435 | group = @desc.get( |
458 | - name + '.bindgroup' + index.to_i.to_s + '.name', nil) | |
436 | + name + '.bindgroup' + index.to_i.to_s + '.name', nil) | |
459 | 437 | default = @desc.get( |
460 | - name + '.bindgroup' + index.to_i.to_s + '.default', 0) | |
438 | + name + '.bindgroup' + index.to_i.to_s + '.default', 0) | |
461 | 439 | if group != nil |
462 | 440 | bind[index] = [group, default] |
463 | 441 | end |
@@ -471,7 +449,7 @@ module Surface | ||
471 | 449 | begin |
472 | 450 | key = key.to_i |
473 | 451 | rescue # except: |
474 | - pass | |
452 | + #pass | |
475 | 453 | else |
476 | 454 | if bind.include?(key) |
477 | 455 | group = bind[key][0].split(',') |
@@ -488,10 +466,10 @@ module Surface | ||
488 | 466 | tooltips = @__tooltips[name] |
489 | 467 | end |
490 | 468 | surface_window = SurfaceWindow.new( |
491 | - gtk_window, side, @desc, surface_alias, @__surface, tooltips, | |
492 | - @__surfaces, seriko, @__region, mayuna, bind, | |
493 | - default_id, @maxsize) | |
494 | - surface_window.set_responsible(self)#.handle_request) | |
469 | + gtk_window, side, @desc, surface_alias, @__surface, tooltips, | |
470 | + @__surfaces, seriko, @__region, mayuna, bind, | |
471 | + default_id, @maxsize) | |
472 | + surface_window.set_responsible(self) | |
495 | 473 | @window << surface_window |
496 | 474 | end |
497 | 475 |
@@ -517,7 +495,6 @@ module Surface | ||
517 | 495 | for value in config[key].split(',') |
518 | 496 | spec << value.strip() |
519 | 497 | end |
520 | -# spec = [value.strip() for value in config[key].split(',')] | |
521 | 498 | begin |
522 | 499 | method, filename, x, y = spec |
523 | 500 | x = x.to_i |
@@ -550,12 +527,10 @@ module Surface | ||
550 | 527 | error = 'unknown method for ' + key + ': ' + method |
551 | 528 | break |
552 | 529 | end |
553 | -# logging.debug(key + ': ' + meyhod + ' ' + filename + ', x=' + x.to_i.to_s + ', y=' + y.to_i.to_s) | |
554 | - print(key + ': ' + method + ' ' + filename + ', x=' + x.to_i.to_s + ', y=' + y.to_i.to_s, "\n") | |
530 | + #logging.debug(key + ': ' + meyhod + ' ' + filename + ', x=' + x.to_i.to_s + ', y=' + y.to_i.to_s) | |
555 | 531 | end |
556 | 532 | if error != nil |
557 | -# logging.error(error) | |
558 | - print(error, "\n") | |
533 | + #logging.error(error) | |
559 | 534 | surface_list = [] |
560 | 535 | end |
561 | 536 | return surface_list |
@@ -676,11 +651,11 @@ module Surface | ||
676 | 651 | x = left + scrn_w - w |
677 | 652 | else |
678 | 653 | b0w, b0h = @parent.handle_request( |
679 | - 'GET', 'get_balloon_size', side - 1) | |
654 | + 'GET', 'get_balloon_size', side - 1) | |
680 | 655 | b1w, b1h = @parent.handle_request( |
681 | - 'GET', 'get_balloon_size', side) | |
656 | + 'GET', 'get_balloon_size', side) | |
682 | 657 | bpx, bpy = @parent.handle_request( |
683 | - 'GET', 'get_balloon_windowposition', side) | |
658 | + 'GET', 'get_balloon_windowposition', side) | |
684 | 659 | o0x, o0y = get_balloon_offset(side - 1) |
685 | 660 | o1x, o1y = get_balloon_offset(side) |
686 | 661 | offset = [0, b1w - (b0w - o0x)].max |
@@ -925,8 +900,14 @@ module Surface | ||
925 | 900 | end |
926 | 901 | x1, y1 = get_position(1) |
927 | 902 | s1w, s1h = get_surface_size(1) |
928 | - if (x0 < x1 + s1w / 2 < x0 + s0w and y0 < y1 + s1h / 2 < y0 + s0h) or \ | |
929 | - (x1 < x0 + s0w / 2 < x1 + s1w and y1 < y0 + s0h / 2 < y1 + s1h) | |
903 | + if (x0 < x1 + s1w / 2 and | |
904 | + x1 + s1w / 2 < x0 + s0w and | |
905 | + y0 < y1 + s1h / 2 and | |
906 | + y1 + s1h / 2 < y0 + s0h) or | |
907 | + (x1 < x0 + s0w / 2 and | |
908 | + x0 + s0w / 2 < x1 + s1w and | |
909 | + y1 < y0 + s0h / 2 and | |
910 | + y0 + s0h / 2 < y1 + s1h) | |
930 | 911 | kasanari = true |
931 | 912 | else |
932 | 913 | kasanari = false |
@@ -955,7 +936,7 @@ module Surface | ||
955 | 936 | @surfaces = surfaces |
956 | 937 | @image_surface = nil # XXX |
957 | 938 | @seriko = Seriko::Controller.new(seriko) |
958 | - @seriko.set_responsible(self)#.handle_request) | |
939 | + @seriko.set_responsible(self) | |
959 | 940 | @region = region |
960 | 941 | @mayuna = mayuna |
961 | 942 | @bind = bind |
@@ -1007,11 +988,10 @@ module Surface | ||
1007 | 988 | end |
1008 | 989 | end |
1009 | 990 | # DnD data types |
1010 | -## FIXME | |
1011 | -# dnd_targets = [Gtk.TargetEntry.new('text/uri-list', 0, 0)] | |
1012 | -# @darea.drag_dest_set(Gtk.DestDefaults.ALL, dnd_targets, | |
1013 | -# Gdk.DragAction.COPY) | |
1014 | -# @darea.drag_dest_add_uri_targets() | |
991 | + dnd_targets = [['text/uri-list', 0, 0]] | |
992 | + @darea.drag_dest_set(Gtk::Drag::DestDefaults::ALL, dnd_targets, | |
993 | + Gdk::DragContext::Action::COPY) | |
994 | + @darea.drag_dest_add_uri_targets() | |
1015 | 995 | end |
1016 | 996 | |
1017 | 997 | def get_seriko |
@@ -1031,8 +1011,8 @@ module Surface | ||
1031 | 1011 | @parent.handle_request('NOTIFY', 'reset_position') # XXX |
1032 | 1012 | left, top, scrn_w, scrn_h = Pix.get_workarea() |
1033 | 1013 | @parent.handle_request( |
1034 | - 'NOTIFY', 'notify_event', 'OnDisplayChange', | |
1035 | - Gdk.Visual.get_best_depth(), scrn_w, scrn_h) | |
1014 | + 'NOTIFY', 'notify_event', 'OnDisplayChange', | |
1015 | + Gdk.Visual.get_best_depth(), scrn_w, scrn_h) | |
1036 | 1016 | end |
1037 | 1017 | end |
1038 | 1018 |
@@ -1040,19 +1020,18 @@ module Surface | ||
1040 | 1020 | @parent = parent |
1041 | 1021 | end |
1042 | 1022 | |
1043 | - def handle_request(event_type, event, *arglist, **argdict) | |
1023 | + def handle_request(event_type, event, *arglist) | |
1044 | 1024 | ##assert ['GET', 'NOTIFY'].include?(event_type) |
1045 | 1025 | handlers = { |
1046 | 1026 | } |
1047 | 1027 | if handlers.include?(event) |
1048 | - result = handlers[event].call #( *arglist, **argdict) | |
1028 | + result = handlers[event].call # no argument | |
1049 | 1029 | else |
1050 | -# handler = handlers.get(event, getattr(self, event, nil)) | |
1051 | -# if handler == nil | |
1052 | - result = @parent.handle_request( | |
1053 | - event_type, event, *arglist, **argdict) | |
1054 | -# else | |
1055 | -# result = handler(*arglist, **argdict) | |
1030 | + if SurfaceWindow.method_defined?(event) | |
1031 | + result = method(event).call(*arglist) | |
1032 | + else | |
1033 | + result = @parent.handle_request(event_type, event, *arglist) | |
1034 | + end | |
1056 | 1035 | end |
1057 | 1036 | if event_type == 'GET' |
1058 | 1037 | return result |
@@ -1067,7 +1046,7 @@ module Surface | ||
1067 | 1046 | def direction=(direction) |
1068 | 1047 | @__direction = direction # 0: left, 1: right |
1069 | 1048 | @parent.handle_request( |
1070 | - 'NOTIFY', 'set_balloon_direction', @side, direction) | |
1049 | + 'NOTIFY', 'set_balloon_direction', @side, direction) | |
1071 | 1050 | end |
1072 | 1051 | |
1073 | 1052 | # @property |
@@ -1082,18 +1061,10 @@ module Surface | ||
1082 | 1061 | side = @side |
1083 | 1062 | if side == 0 |
1084 | 1063 | name = 'sakura' |
1085 | -# x = config.get_with_type( | |
1086 | -# name + '.balloon.offsetx', int) | |
1087 | -# y = config.get_with_type( | |
1088 | -# name + '.balloon.offsety', int) | |
1089 | 1064 | x = config.get(name + '.balloon.offsetx').to_i |
1090 | 1065 | y = config.get(name + '.balloon.offsety').to_i |
1091 | 1066 | elsif side == 1 |
1092 | 1067 | name = 'kero' |
1093 | -# x = config.get_with_type( | |
1094 | -# name + '.balloon.offsetx', int) | |
1095 | -# y = config.get_with_type( | |
1096 | -# name + '.balloon.offsety', int) | |
1097 | 1068 | x = config.get(name + '.balloon.offsetx').to_i |
1098 | 1069 | y = config.get(name + '.balloon.offsety').to_i |
1099 | 1070 | else |
@@ -1101,8 +1072,6 @@ module Surface | ||
1101 | 1072 | x, y = nil, nil # XXX |
1102 | 1073 | end |
1103 | 1074 | if x == nil |
1104 | -# x = @desc.get_with_type( | |
1105 | -# name + '.balloon.offsetx', int, 0) | |
1106 | 1075 | x = @desc.get(name + '.balloon.offsetx') |
1107 | 1076 | if x == nil |
1108 | 1077 | x = 0 |
@@ -1111,8 +1080,6 @@ module Surface | ||
1111 | 1080 | end |
1112 | 1081 | end |
1113 | 1082 | if y == nil |
1114 | -# y = @desc.get_with_type( | |
1115 | -# name + '.balloon.offsety', int, 0) | |
1116 | 1083 | y = @desc.get(name + '.balloon.offsety') |
1117 | 1084 | if y == nil |
1118 | 1085 | y = 0 |
@@ -1143,8 +1110,8 @@ module Surface | ||
1143 | 1110 | end |
1144 | 1111 | if filelist |
1145 | 1112 | @parent.handle_request( |
1146 | - 'NOTIFY', 'enqueue_event', | |
1147 | - 'OnFileDrop2', chr(1).join(filelist), @side) | |
1113 | + 'NOTIFY', 'enqueue_event', | |
1114 | + 'OnFileDrop2', chr(1).join(filelist), @side) | |
1148 | 1115 | end |
1149 | 1116 | end |
1150 | 1117 |
@@ -1185,7 +1152,7 @@ module Surface | ||
1185 | 1152 | @seriko.terminate(self) |
1186 | 1153 | end |
1187 | 1154 | if ['-1', '-2'].include?(surface_id) |
1188 | - pass | |
1155 | + #pass | |
1189 | 1156 | elsif not @surfaces.include?(surface_id) |
1190 | 1157 | @surface_id = @default_id |
1191 | 1158 | else |
@@ -1222,13 +1189,13 @@ module Surface | ||
1222 | 1189 | w, h = get_surface_size(@surface_id) |
1223 | 1190 | new_x, new_y = get_position() |
1224 | 1191 | @parent.handle_request( |
1225 | - 'NOTIFY', 'notify_event', | |
1226 | - 'OnSurfaceChange', | |
1227 | - @parent.handle_request('GET', 'get_surface_id', 0), | |
1228 | - @parent.handle_request('GET', 'get_surface_id', 1), | |
1229 | - [@side, @surface_id, w, h].join(','), | |
1230 | - prev_id.to_s, | |
1231 | - [new_x, new_y, new_x + w, new_y + h].join(',')) | |
1192 | + 'NOTIFY', 'notify_event', | |
1193 | + 'OnSurfaceChange', | |
1194 | + @parent.handle_request('GET', 'get_surface_id', 0), | |
1195 | + @parent.handle_request('GET', 'get_surface_id', 1), | |
1196 | + [@side, @surface_id, w, h].join(','), | |
1197 | + prev_id.to_s, | |
1198 | + [new_x, new_y, new_x + w, new_y + h].join(',')) | |
1232 | 1199 | update_frame_buffer() #XXX |
1233 | 1200 | end |
1234 | 1201 |
@@ -1277,10 +1244,9 @@ module Surface | ||
1277 | 1244 | end |
1278 | 1245 | begin |
1279 | 1246 | surface = Pix.create_surface_from_file( |
1280 | - @surfaces[surface_id][0], is_pnr=is_pnr, use_pna=use_pna) | |
1247 | + @surfaces[surface_id][0], is_pnr=is_pnr, use_pna=use_pna) | |
1281 | 1248 | rescue # except: |
1282 | -# logging.debug('cannot load surface #{0}'.format(surface_id)) | |
1283 | - print('cannot load surface #' + surface_id, "\n") | |
1249 | + #logging.debug('cannot load surface #{0}'.format(surface_id)) | |
1284 | 1250 | return Pix.create_blank_surface(100, 100) |
1285 | 1251 | end |
1286 | 1252 | for element, x, y, method in @surfaces[surface_id][1, @surfaces[surface_id].length - 1] |
@@ -1291,10 +1257,10 @@ module Surface | ||
1291 | 1257 | else |
1292 | 1258 | is_pnr = true |
1293 | 1259 | use_pna = @parent.handle_request( |
1294 | - 'GET', 'get_preference', 'use_pna') | |
1260 | + 'GET', 'get_preference', 'use_pna') | |
1295 | 1261 | end |
1296 | 1262 | overlay = Pix.create_surface_from_file( |
1297 | - element, is_pnr=is_pnr, use_pna=use_pna) | |
1263 | + element, is_pnr=is_pnr, use_pna=use_pna) | |
1298 | 1264 | rescue # except: |
1299 | 1265 | next |
1300 | 1266 | end |
@@ -1322,8 +1288,7 @@ module Surface | ||
1322 | 1288 | |
1323 | 1289 | def get_image_surface(surface_id, is_asis=false) |
1324 | 1290 | if not @surfaces.include?(surface_id) |
1325 | -# logging.debug('cannot load surface #{0}'.format(surface_id)) | |
1326 | - print('cannot load surface #' + surface_id.to_s, "\n") | |
1291 | + #logging.debug('cannot load surface #{0}'.format(surface_id)) | |
1327 | 1292 | return Pix.create_blank_surface(100, 100) |
1328 | 1293 | end |
1329 | 1294 | return create_surface_from_file(surface_id, is_asis=is_asis) |
@@ -1347,13 +1312,10 @@ module Surface | ||
1347 | 1312 | font_desc = Pango::FontDescription.new |
1348 | 1313 | font_desc.set_size(8 * Pango::SCALE) |
1349 | 1314 | layout = cr.create_pango_layout |
1350 | -# layout = Pango::Layout.new(@darea.pango_context) | |
1351 | 1315 | layout.set_font_description(font_desc) |
1352 | 1316 | layout.set_wrap(Pango::WRAP_WORD_CHAR) # XXX |
1353 | 1317 | layout.set_text(part) |
1354 | 1318 | cr.show_pango_layout(layout) |
1355 | -# PangoCairo.update_layout(cr, layout) | |
1356 | -# PangoCairo.show_layout(cr, layout) | |
1357 | 1319 | end |
1358 | 1320 | cr.set_operator(Cairo::OPERATOR_ATOP) |
1359 | 1321 | cr.set_source_rgba(0.2, 0.0, 0.0, 0.4) # XXX |
@@ -1415,7 +1377,7 @@ module Surface | ||
1415 | 1377 | for surface_id, x, y, method in @seriko.iter_overlays() |
1416 | 1378 | begin |
1417 | 1379 | overlay_surface = get_image_surface( |
1418 | - surface_id, is_asis=(method == 'asis')) | |
1380 | + surface_id, is_asis=(method == 'asis')) | |
1419 | 1381 | rescue # except: |
1420 | 1382 | next |
1421 | 1383 | end |
@@ -1437,7 +1399,7 @@ module Surface | ||
1437 | 1399 | else |
1438 | 1400 | cr.paint() |
1439 | 1401 | end |
1440 | -# del cr | |
1402 | + #del cr | |
1441 | 1403 | end |
1442 | 1404 | @image_surface = new_surface |
1443 | 1405 | @darea.queue_draw() |
@@ -1471,7 +1433,7 @@ module Surface | ||
1471 | 1433 | if @side < 2 |
1472 | 1434 | args = [@side, xoffset, yoffset] |
1473 | 1435 | @parent.handle_request( |
1474 | - 'NOTIFY', 'notify_observer', 'move surface', args) # animation | |
1436 | + 'NOTIFY', 'notify_observer', 'move surface', args) # animation | |
1475 | 1437 | end |
1476 | 1438 | end |
1477 | 1439 |
@@ -1526,33 +1488,45 @@ module Surface | ||
1526 | 1488 | end |
1527 | 1489 | for part, x1, y1, x2, y2 in @collisions |
1528 | 1490 | if x1 <= x and x <= x2 and y1 <= y and y <= y2 |
1529 | - ##logging.debug('{0} touched'.format(part)) | |
1491 | + #logging.debug('{0} touched'.format(part)) | |
1530 | 1492 | return part |
1531 | 1493 | end |
1532 | 1494 | end |
1533 | 1495 | return '' |
1534 | 1496 | end |
1535 | 1497 | |
1536 | - def __get_with_scaling(name, conv) | |
1498 | + def __get_with_scaling(name) | |
1537 | 1499 | basename = ['surface', @surface_id].join('') |
1538 | 1500 | path, config = @surface_info[basename] |
1539 | - value = config.get_with_type(name, conv) | |
1501 | + value = config.get(name) | |
1540 | 1502 | if value != nil |
1541 | 1503 | scale = get_scale |
1542 | - value = conv(value * scale / 100) | |
1504 | + value = value.to_f * scale / 100 | |
1543 | 1505 | end |
1544 | 1506 | return value |
1545 | 1507 | end |
1546 | 1508 | |
1547 | 1509 | def get_center |
1548 | - centerx = __get_with_scaling('point.centerx', int) | |
1549 | - centery = __get_with_scaling('point.centery', int) | |
1510 | + centerx = __get_with_scaling('point.centerx') | |
1511 | + centery = __get_with_scaling('point.centery') | |
1512 | + if centerx | |
1513 | + centerx = centerx.to_i | |
1514 | + end | |
1515 | + if centery | |
1516 | + centery = centery.to_i | |
1517 | + end | |
1550 | 1518 | return centerx, centery |
1551 | 1519 | end |
1552 | 1520 | |
1553 | 1521 | def get_kinoko_center |
1554 | - centerx = __get_with_scaling('point.kinoko.centerx', int) | |
1555 | - centery = __get_with_scaling('point.kinoko.centery', int) | |
1522 | + centerx = __get_with_scaling('point.kinoko.centerx') | |
1523 | + centery = __get_with_scaling('point.kinoko.centery') | |
1524 | + if centerx | |
1525 | + centerx = centerx.to_i | |
1526 | + end | |
1527 | + if centery | |
1528 | + centery = centery.to_i | |
1529 | + end | |
1556 | 1530 | return centerx, centery |
1557 | 1531 | end |
1558 | 1532 |
@@ -1582,7 +1556,7 @@ module Surface | ||
1582 | 1556 | end |
1583 | 1557 | base_y = new_y + oy |
1584 | 1558 | @parent.handle_request( |
1585 | - 'NOTIFY', 'set_balloon_position', @side, base_x, base_y) | |
1559 | + 'NOTIFY', 'set_balloon_position', @side, base_x, base_y) | |
1586 | 1560 | @parent.handle_request('NOTIFY', 'notify_observer', 'set position') |
1587 | 1561 | @parent.handle_request('NOTIFY', 'check_mikire_kasanari') |
1588 | 1562 | end |
@@ -1615,7 +1589,7 @@ module Surface | ||
1615 | 1589 | sy = top |
1616 | 1590 | set_position(sx, sy) |
1617 | 1591 | else # free |
1618 | - pass | |
1592 | + #pass | |
1619 | 1593 | end |
1620 | 1594 | end |
1621 | 1595 |
@@ -1652,69 +1626,65 @@ module Surface | ||
1652 | 1626 | @window.hide() |
1653 | 1627 | @__shown = false |
1654 | 1628 | @parent.handle_request( |
1655 | - 'NOTIFY', 'notify_observer', 'hide', (@side)) | |
1629 | + 'NOTIFY', 'notify_observer', 'hide', (@side)) | |
1656 | 1630 | end |
1657 | 1631 | end |
1658 | 1632 | |
1659 | 1633 | def raise_ |
1660 | - @window.get_window().raise_() | |
1634 | + @window.window.raise_() | |
1661 | 1635 | @parent.handle_request('NOTIFY', 'notify_observer', 'raise', (@side)) |
1662 | 1636 | end |
1663 | 1637 | |
1664 | 1638 | def lower |
1665 | - @window.get_window().lower() | |
1639 | + @window.window.lower() | |
1666 | 1640 | @parent.handle_request('NOTIFY', 'notify_observer', 'lower', (@side)) |
1667 | 1641 | end |
1668 | 1642 | |
1669 | 1643 | def button_press(window, event) |
1670 | 1644 | @parent.handle_request('NOTIFY', 'reset_idle_time') |
1671 | 1645 | x, y = @window.winpos_to_surfacepos( |
1672 | - event.x.to_i, event.y.to_i, get_scale) | |
1646 | + event.x.to_i, event.y.to_i, get_scale) | |
1673 | 1647 | @x_root = event.x_root |
1674 | 1648 | @y_root = event.y_root |
1675 | 1649 | # automagical raise |
1676 | 1650 | @parent.handle_request('NOTIFY', 'notify_observer', 'raise', (@side)) |
1677 | 1651 | if event.event_type == Gdk::Event::BUTTON2_PRESS |
1678 | - click_count = 2 | |
1679 | - else | |
1680 | - click_count = 1 | |
1681 | - end | |
1682 | - ## FIXME | |
1683 | - #delivered, click_count = event.get_click_count() | |
1684 | - #if delivered | |
1685 | - if true | |
1686 | - @click_count = click_count | |
1687 | - if [1, 2, 3].include?(event.button) | |
1688 | - num_button = [0, 2, 1][event.button - 1] | |
1689 | - @parent.handle_request('NOTIFY', 'notify_event', 'OnMouseDown', | |
1690 | - x, y, 0, @side, @__current_part, | |
1691 | - num_button, | |
1692 | - 'mouse') # FIXME | |
1693 | - end | |
1694 | - if [2, 8, 9].include?(event.button) | |
1695 | - ex_button = { | |
1696 | - 2 => 'middle', | |
1697 | - 8 => 'xbutton1', | |
1698 | - 9 => 'xbutton2' | |
1699 | - }[event.button] | |
1700 | - @parent.handle_request('NOTIFY', 'notify_event', 'OnMouseDownEx', | |
1701 | - x, y, 0, @side, @__current_part, | |
1702 | - ex_button, | |
1703 | - 'mouse') # FIXME | |
1704 | - end | |
1652 | + @click_count = 2 | |
1653 | + else # XXX | |
1654 | + @click_count = 1 | |
1655 | + end | |
1656 | + if [1, 2, 3].include?(event.button) | |
1657 | + num_button = [0, 2, 1][event.button - 1] | |
1658 | + @parent.handle_request('NOTIFY', 'notify_event', 'OnMouseDown', | |
1659 | + x, y, 0, @side, @__current_part, | |
1660 | + num_button, | |
1661 | + 'mouse') # FIXME | |
1662 | + end | |
1663 | + if [2, 8, 9].include?(event.button) | |
1664 | + ex_button = { | |
1665 | + 2 => 'middle', | |
1666 | + 8 => 'xbutton1', | |
1667 | + 9 => 'xbutton2' | |
1668 | + }[event.button] | |
1669 | + @parent.handle_request('NOTIFY', 'notify_event', 'OnMouseDownEx', | |
1670 | + x, y, 0, @side, @__current_part, | |
1671 | + ex_button, | |
1672 | + 'mouse') # FIXME | |
1705 | 1673 | end |
1706 | 1674 | return true |
1707 | 1675 | end |
1708 | 1676 | |
1677 | + CURSOR_HAND1 = Gdk::Cursor.new(Gdk::Cursor::Type::HAND1) | |
1678 | + | |
1709 | 1679 | def button_release(window, event) |
1710 | 1680 | x, y = @window.winpos_to_surfacepos( |
1711 | - event.x.to_i, event.y.to_i, get_scale) | |
1681 | + event.x.to_i, event.y.to_i, get_scale) | |
1712 | 1682 | if @dragged |
1713 | 1683 | @dragged = false |
1714 | 1684 | set_alignment_current() |
1715 | 1685 | @parent.handle_request( |
1716 | - 'NOTIFY', 'notify_event', | |
1717 | - 'OnMouseDragEnd', x, y, '', @side, @__current_part, '') | |
1686 | + 'NOTIFY', 'notify_event', | |
1687 | + 'OnMouseDragEnd', x, y, '', @side, @__current_part, '') | |
1718 | 1688 | end |
1719 | 1689 | @x_root = nil |
1720 | 1690 | @y_root = nil |
@@ -1738,10 +1708,10 @@ module Surface | ||
1738 | 1708 | if part != @__current_part |
1739 | 1709 | if part == '' |
1740 | 1710 | @window.set_tooltip_text('') |
1741 | - @darea.get_window().set_cursor(nil) | |
1711 | + @darea.window.set_cursor(nil) | |
1742 | 1712 | @parent.handle_request( |
1743 | - 'NOTIFY', 'notify_event', | |
1744 | - 'OnMouseLeave', x, y, '', @side, @__current_part) | |
1713 | + 'NOTIFY', 'notify_event', | |
1714 | + 'OnMouseLeave', x, y, '', @side, @__current_part) | |
1745 | 1715 | else |
1746 | 1716 | if @tooltips.include?(part) |
1747 | 1717 | tooltip = @tooltips[part] |
@@ -1749,23 +1719,22 @@ module Surface | ||
1749 | 1719 | else |
1750 | 1720 | @window.set_tooltip_text('') |
1751 | 1721 | end |
1752 | - cursor = Gdk.Cursor.new(Gdk.CursorType.HAND1) | |
1753 | - @darea.get_window().set_cursor(cursor) | |
1722 | + @darea.window.set_cursor(CURSOR_HAND1) | |
1754 | 1723 | @parent.handle_request( |
1755 | - 'NOTIFY', 'notify_event', | |
1756 | - 'OnMouseEnter', x, y, '', @side, part) | |
1724 | + 'NOTIFY', 'notify_event', | |
1725 | + 'OnMouseEnter', x, y, '', @side, part) | |
1757 | 1726 | end |
1758 | 1727 | end |
1759 | 1728 | @__current_part = part |
1760 | 1729 | if not @parent.handle_request('GET', 'busy') |
1761 | - if state & Gdk.ModifierType.BUTTON1_MASK | |
1730 | + if (state & Gdk::Window::ModifierType::BUTTON1_MASK).nonzero? | |
1762 | 1731 | if @x_root != nil and \ |
1763 | 1732 | @y_root != nil |
1764 | 1733 | if not @dragged |
1765 | 1734 | @parent.handle_request( |
1766 | - 'NOTIFY', 'notify_event', | |
1767 | - 'OnMouseDragStart', x, y, '', | |
1768 | - @side, @__current_part, '') | |
1735 | + 'NOTIFY', 'notify_event', | |
1736 | + 'OnMouseDragStart', x, y, '', | |
1737 | + @side, @__current_part, '') | |
1769 | 1738 | end |
1770 | 1739 | @dragged = true |
1771 | 1740 | x_delta = (event.x_root - @x_root).to_i |
@@ -1775,9 +1744,9 @@ module Surface | ||
1775 | 1744 | @x_root = event.x_root |
1776 | 1745 | @y_root = event.y_root |
1777 | 1746 | end |
1778 | - elsif state & Gdk.ModifierType.BUTTON2_MASK or \ | |
1779 | - state & Gdk.ModifierType.BUTTON3_MASK | |
1780 | - pass | |
1747 | + elsif (state & Gdk::Window::ModifierType::BUTTON2_MASK).nonzero? or \ | |
1748 | + (state & Gdk::Window::ModifierType::BUTTON3_MASK).nonzero? | |
1749 | + #pass | |
1781 | 1750 | else |
1782 | 1751 | @parent.handle_request('NOTIFY', 'notify_surface_mouse_motion', |
1783 | 1752 | @side, x, y, part) |
@@ -1788,10 +1757,10 @@ module Surface | ||
1788 | 1757 | |
1789 | 1758 | def scroll(darea, event) |
1790 | 1759 | x, y = @window.winpos_to_surfacepos( |
1791 | - event.x.to_i, event.y.to_i, get_scale) | |
1792 | - if event.direction == Gdk.ScrollDirection.UP | |
1760 | + event.x.to_i, event.y.to_i, get_scale) | |
1761 | + if event.direction == Gdk::EventScroll::UP | |
1793 | 1762 | count = 1 |
1794 | - elsif event.direction == Gdk.ScrollDirection.DOWN | |
1763 | + elsif event.direction == Gdk::EventScroll::DOWN | |
1795 | 1764 | count = -1 |
1796 | 1765 | else |
1797 | 1766 | count = 0 |
@@ -1838,13 +1807,13 @@ module Surface | ||
1838 | 1807 | x, y = @window.winpos_to_surfacepos(x, y, get_scale) |
1839 | 1808 | if @__current_part != '' # XXX |
1840 | 1809 | @parent.handle_request( |
1841 | - 'NOTIFY', 'notify_event', | |
1842 | - 'OnMouseLeave', x, y, '', @side, @__current_part) | |
1810 | + 'NOTIFY', 'notify_event', | |
1811 | + 'OnMouseLeave', x, y, '', @side, @__current_part) | |
1843 | 1812 | @__current_part = '' |
1844 | 1813 | end |
1845 | 1814 | @parent.handle_request( |
1846 | - 'NOTIFY', 'notify_event', | |
1847 | - 'OnMouseLeaveAll', x, y, '', @side, '') | |
1815 | + 'NOTIFY', 'notify_event', | |
1816 | + 'OnMouseLeaveAll', x, y, '', @side, '') | |
1848 | 1817 | return true |
1849 | 1818 | end |
1850 | 1819 | end |
@@ -14,8 +14,8 @@ module NinixTest | ||
14 | 14 | balloon.new_(*balloons[key]) |
15 | 15 | balloon.set_balloon(0, 0) |
16 | 16 | balloon.set_balloon(1, 0) |
17 | - balloon.set_position(0, 200, 200) | |
18 | - balloon.set_position(1, 100, 100) | |
17 | + balloon.set_position(0, 400, 200) | |
18 | + balloon.set_position(1, 200, 100) | |
19 | 19 | balloon.show(0) |
20 | 20 | balloon.show(1) |
21 | 21 | balloon.show_sstp_message("TEST: SSTP", "TEST class") |
@@ -44,6 +44,9 @@ module NinixTest | ||
44 | 44 | def attach_observer(arg) # dummy |
45 | 45 | end |
46 | 46 | |
47 | + def detach_observer(arg) # dummy | |
48 | + end | |
49 | + | |
47 | 50 | def get_surface_scale() # dummy |
48 | 51 | return 100 |
49 | 52 | end |