merrol 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. data/.autotest +7 -0
  2. data/.gitignore +4 -0
  3. data/.rspec +2 -0
  4. data/LICENSE +23 -0
  5. data/README.md +58 -0
  6. data/ROADMAP.md +22 -0
  7. data/Rakefile +63 -0
  8. data/autotest/discover.rb +2 -0
  9. data/bin/m +9 -0
  10. data/config/commands.yml +150 -0
  11. data/config/language.yml +47 -0
  12. data/config/messages.yml +3 -0
  13. data/config/settings.yml +3 -0
  14. data/config/snippets/rails.yml +22 -0
  15. data/config/snippets/rspec.yml +35 -0
  16. data/config/snippets/ruby.yml +97 -0
  17. data/config/styles/Railscasts.xml +121 -0
  18. data/config/templates/rails.yml +21 -0
  19. data/config/templates/rspec.yml +6 -0
  20. data/data/images/merrol.svg +412 -0
  21. data/data/images/merrol2.svg +531 -0
  22. data/data/images/modified.svg +156 -0
  23. data/data/images/saved.svg +156 -0
  24. data/lib/merrol/controllers/controller.rb +26 -0
  25. data/lib/merrol/controllers/edit_controller.rb +24 -0
  26. data/lib/merrol/controllers/file_controller.rb +61 -0
  27. data/lib/merrol/controllers/help_controller.rb +6 -0
  28. data/lib/merrol/controllers/main_controller.rb +26 -0
  29. data/lib/merrol/controllers/search_controller.rb +5 -0
  30. data/lib/merrol/controllers/tools_controller.rb +28 -0
  31. data/lib/merrol/gtk/bin.rb +11 -0
  32. data/lib/merrol/gtk/image.rb +8 -0
  33. data/lib/merrol/gtk/list_view.rb +43 -0
  34. data/lib/merrol/gtk/source_view.rb +22 -0
  35. data/lib/merrol/gtk/widget.rb +12 -0
  36. data/lib/merrol/gtk/window.rb +18 -0
  37. data/lib/merrol/keyboard_map.rb +136 -0
  38. data/lib/merrol/lib/application.rb +29 -0
  39. data/lib/merrol/lib/commands.rb +40 -0
  40. data/lib/merrol/lib/file.rb +6 -0
  41. data/lib/merrol/lib/shortcut.rb +35 -0
  42. data/lib/merrol/lib/widget_builder.rb +49 -0
  43. data/lib/merrol/lib/yaml.rb +10 -0
  44. data/lib/merrol/models/source_model.rb +44 -0
  45. data/lib/merrol/views/edit.yml +50 -0
  46. data/lib/merrol/views/file_list.yml +11 -0
  47. data/lib/merrol/views/file_path.yml +8 -0
  48. data/lib/merrol/views/file_status.yml +6 -0
  49. data/lib/merrol/views/hbox.yml +6 -0
  50. data/lib/merrol/views/main.yml +9 -0
  51. data/lib/merrol/views/scroll_bars.yml +15 -0
  52. data/lib/merrol/views/status_bar.yml +7 -0
  53. data/lib/merrol.rb +16 -0
  54. data/lib/prerequisites.rb +54 -0
  55. data/merrol.gemspec +24 -0
  56. data/spec/controllers/controller_spec.rb +27 -0
  57. data/spec/controllers/edit_controller_spec.rb +38 -0
  58. data/spec/controllers/file_controller_spec.rb +209 -0
  59. data/spec/controllers/main_controller_spec.rb +20 -0
  60. data/spec/gtk/bin_spec.rb +13 -0
  61. data/spec/gtk/list_view_spec.rb +114 -0
  62. data/spec/gtk/source_view_spec.rb +41 -0
  63. data/spec/gtk/widget_spec.rb +37 -0
  64. data/spec/gtk/window_spec.rb +28 -0
  65. data/spec/integration/000_startup_spec.rb +14 -0
  66. data/spec/integration/001_load_from_commandline_spec.rb +25 -0
  67. data/spec/integration/002_loading_and_saving_spec.rb +35 -0
  68. data/spec/integration/003_tab_file_switching_spec.rb +49 -0
  69. data/spec/integration/ideas_spec.rb +23 -0
  70. data/spec/integration_helper.rb +11 -0
  71. data/spec/lib/application_spec.rb +57 -0
  72. data/spec/lib/commands_spec.rb +63 -0
  73. data/spec/lib/file_spec.rb +9 -0
  74. data/spec/lib/shortcut_spec.rb +59 -0
  75. data/spec/lib/widget_builder_spec.rb +77 -0
  76. data/spec/lib/yaml_spec.rb +26 -0
  77. data/spec/models/source_model_spec.rb +80 -0
  78. data/spec/spec_helper.rb +18 -0
  79. data/spec/support/actions.rb +28 -0
  80. data/spec/support/expectations.rb +46 -0
  81. data/spec/support/setup.rb +32 -0
  82. metadata +224 -0
@@ -0,0 +1,156 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!-- Created with Inkscape (http://www.inkscape.org/) -->
3
+
4
+ <svg
5
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
6
+ xmlns:cc="http://creativecommons.org/ns#"
7
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8
+ xmlns:svg="http://www.w3.org/2000/svg"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ xmlns:xlink="http://www.w3.org/1999/xlink"
11
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
12
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
13
+ width="16"
14
+ height="16"
15
+ id="svg1800"
16
+ sodipodi:version="0.32"
17
+ inkscape:version="0.47 r22583"
18
+ sodipodi:docname="modified.svg"
19
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
20
+ version="1.1"
21
+ inkscape:export-filename="/home/phil/workspace/projects/merrol/data/images/modified.png"
22
+ inkscape:export-xdpi="78.889999"
23
+ inkscape:export-ydpi="78.889999">
24
+ <defs
25
+ id="defs3">
26
+ <inkscape:perspective
27
+ sodipodi:type="inkscape:persp3d"
28
+ inkscape:vp_x="0 : 24 : 1"
29
+ inkscape:vp_y="0 : 1000 : 0"
30
+ inkscape:vp_z="48 : 24 : 1"
31
+ inkscape:persp3d-origin="24 : 16 : 1"
32
+ id="perspective17" />
33
+ <linearGradient
34
+ inkscape:collect="always"
35
+ id="linearGradient3101">
36
+ <stop
37
+ style="stop-color:#000000;stop-opacity:1;"
38
+ offset="0"
39
+ id="stop3103" />
40
+ <stop
41
+ style="stop-color:#000000;stop-opacity:0;"
42
+ offset="1"
43
+ id="stop3105" />
44
+ </linearGradient>
45
+ <radialGradient
46
+ inkscape:collect="always"
47
+ xlink:href="#linearGradient3101"
48
+ id="radialGradient3107"
49
+ cx="17.3125"
50
+ cy="25.53125"
51
+ fx="17.3125"
52
+ fy="25.53125"
53
+ r="9.6875"
54
+ gradientTransform="matrix(1,0,0,0.351613,0,16.55413)"
55
+ gradientUnits="userSpaceOnUse" />
56
+ </defs>
57
+ <sodipodi:namedview
58
+ fill="#edd400"
59
+ id="base"
60
+ pagecolor="#ffffff"
61
+ bordercolor="#666666"
62
+ borderopacity="0.20392157"
63
+ inkscape:pageopacity="0.0"
64
+ inkscape:pageshadow="2"
65
+ inkscape:zoom="35.75"
66
+ inkscape:cx="9.3628723"
67
+ inkscape:cy="6.2333121"
68
+ inkscape:current-layer="layer1"
69
+ showgrid="false"
70
+ inkscape:grid-bbox="true"
71
+ inkscape:document-units="px"
72
+ inkscape:showpageshadow="false"
73
+ inkscape:window-width="1270"
74
+ inkscape:window-height="879"
75
+ inkscape:window-x="520"
76
+ inkscape:window-y="64"
77
+ inkscape:window-maximized="0" />
78
+ <metadata
79
+ id="metadata4">
80
+ <rdf:RDF>
81
+ <cc:Work
82
+ rdf:about="">
83
+ <dc:format>image/svg+xml</dc:format>
84
+ <dc:type
85
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
86
+ <cc:license
87
+ rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
88
+ <dc:title />
89
+ <dc:creator>
90
+ <cc:Agent>
91
+ <dc:title>Jakub Steiner</dc:title>
92
+ </cc:Agent>
93
+ </dc:creator>
94
+ <dc:subject>
95
+ <rdf:Bag>
96
+ <rdf:li>emblem</rdf:li>
97
+ <rdf:li>photos</rdf:li>
98
+ <rdf:li>pictures</rdf:li>
99
+ <rdf:li>raw</rdf:li>
100
+ <rdf:li>jpeg</rdf:li>
101
+ </rdf:Bag>
102
+ </dc:subject>
103
+ </cc:Work>
104
+ <cc:License
105
+ rdf:about="http://creativecommons.org/licenses/publicdomain/">
106
+ <cc:permits
107
+ rdf:resource="http://creativecommons.org/ns#Reproduction" />
108
+ <cc:permits
109
+ rdf:resource="http://creativecommons.org/ns#Distribution" />
110
+ <cc:permits
111
+ rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
112
+ </cc:License>
113
+ </rdf:RDF>
114
+ </metadata>
115
+ <g
116
+ id="layer1"
117
+ inkscape:label="Layer 1"
118
+ inkscape:groupmode="layer"
119
+ transform="translate(0,-32)">
120
+ <path
121
+ transform="matrix(0.25916113,0,0,0.26887949,1.8391671,33.545719)"
122
+ d="m 46.138718,23.42804 a 22.008699,21.213203 0 1 1 -44.0173992,0 22.008699,21.213203 0 1 1 44.0173992,0 z"
123
+ sodipodi:ry="21.213203"
124
+ sodipodi:rx="22.008699"
125
+ sodipodi:cy="23.42804"
126
+ sodipodi:cx="24.130018"
127
+ id="path3591"
128
+ style="fill:#ffffff;fill-opacity:0.76687113;fill-rule:nonzero;stroke:none"
129
+ sodipodi:type="arc" />
130
+ <path
131
+ sodipodi:type="arc"
132
+ style="fill:#f57900;fill-opacity:1;fill-rule:nonzero;stroke:#914900;stroke-width:4.64271879;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
133
+ id="path1650"
134
+ sodipodi:cx="24.130018"
135
+ sodipodi:cy="23.42804"
136
+ sodipodi:rx="22.008699"
137
+ sodipodi:ry="21.213203"
138
+ d="m 46.138718,23.42804 a 22.008699,21.213203 0 1 1 -44.0173992,0 22.008699,21.213203 0 1 1 44.0173992,0 z"
139
+ transform="matrix(0.21812151,0,0,0.2263009,2.8294541,34.543252)" />
140
+ <path
141
+ sodipodi:type="arc"
142
+ style="fill:none;stroke:#fcdb05;stroke-width:2.11304855;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
143
+ id="path3392"
144
+ sodipodi:cx="24.130018"
145
+ sodipodi:cy="23.42804"
146
+ sodipodi:rx="22.008699"
147
+ sodipodi:ry="21.213203"
148
+ d="m 46.138718,23.42804 a 22.008699,21.213203 0 1 1 -44.0173992,0 22.008699,21.213203 0 1 1 44.0173992,0 z"
149
+ transform="matrix(0.19478396,0,0,0.20208831,3.4225467,35.090879)" />
150
+ <path
151
+ style="fill:#fffeff;fill-opacity:0.21390375;fill-rule:nonzero;stroke:none"
152
+ d="m 12.257886,39.645783 c 0,2.327923 -1.300846,-0.92557 -4.0139308,0.08306 -2.7345652,1.016607 -4.4205725,2.244872 -4.4205725,-0.08306 0,-2.327922 1.8893287,-4.217251 4.2172524,-4.217251 2.3279219,0 4.2172509,1.889329 4.2172509,4.217251 z"
153
+ id="path3068"
154
+ sodipodi:nodetypes="czssc" />
155
+ </g>
156
+ </svg>
@@ -0,0 +1,156 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!-- Created with Inkscape (http://www.inkscape.org/) -->
3
+
4
+ <svg
5
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
6
+ xmlns:cc="http://creativecommons.org/ns#"
7
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8
+ xmlns:svg="http://www.w3.org/2000/svg"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ xmlns:xlink="http://www.w3.org/1999/xlink"
11
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
12
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
13
+ width="16"
14
+ height="16"
15
+ id="svg1800"
16
+ sodipodi:version="0.32"
17
+ inkscape:version="0.47 r22583"
18
+ sodipodi:docname="modified.svg"
19
+ inkscape:output_extension="org.inkscape.output.svg.inkscape"
20
+ version="1.1"
21
+ inkscape:export-filename="/home/phil/workspace/projects/merrol/data/images/modified.png"
22
+ inkscape:export-xdpi="78.889999"
23
+ inkscape:export-ydpi="78.889999">
24
+ <defs
25
+ id="defs3">
26
+ <inkscape:perspective
27
+ sodipodi:type="inkscape:persp3d"
28
+ inkscape:vp_x="0 : 24 : 1"
29
+ inkscape:vp_y="0 : 1000 : 0"
30
+ inkscape:vp_z="48 : 24 : 1"
31
+ inkscape:persp3d-origin="24 : 16 : 1"
32
+ id="perspective17" />
33
+ <linearGradient
34
+ inkscape:collect="always"
35
+ id="linearGradient3101">
36
+ <stop
37
+ style="stop-color:#000000;stop-opacity:1;"
38
+ offset="0"
39
+ id="stop3103" />
40
+ <stop
41
+ style="stop-color:#000000;stop-opacity:0;"
42
+ offset="1"
43
+ id="stop3105" />
44
+ </linearGradient>
45
+ <radialGradient
46
+ inkscape:collect="always"
47
+ xlink:href="#linearGradient3101"
48
+ id="radialGradient3107"
49
+ cx="17.3125"
50
+ cy="25.53125"
51
+ fx="17.3125"
52
+ fy="25.53125"
53
+ r="9.6875"
54
+ gradientTransform="matrix(1,0,0,0.351613,0,16.55413)"
55
+ gradientUnits="userSpaceOnUse" />
56
+ </defs>
57
+ <sodipodi:namedview
58
+ fill="#edd400"
59
+ id="base"
60
+ pagecolor="#ffffff"
61
+ bordercolor="#666666"
62
+ borderopacity="0.20392157"
63
+ inkscape:pageopacity="0.0"
64
+ inkscape:pageshadow="2"
65
+ inkscape:zoom="35.75"
66
+ inkscape:cx="9.3628723"
67
+ inkscape:cy="6.2333121"
68
+ inkscape:current-layer="layer1"
69
+ showgrid="false"
70
+ inkscape:grid-bbox="true"
71
+ inkscape:document-units="px"
72
+ inkscape:showpageshadow="false"
73
+ inkscape:window-width="1270"
74
+ inkscape:window-height="879"
75
+ inkscape:window-x="520"
76
+ inkscape:window-y="64"
77
+ inkscape:window-maximized="0" />
78
+ <metadata
79
+ id="metadata4">
80
+ <rdf:RDF>
81
+ <cc:Work
82
+ rdf:about="">
83
+ <dc:format>image/svg+xml</dc:format>
84
+ <dc:type
85
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
86
+ <cc:license
87
+ rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
88
+ <dc:title></dc:title>
89
+ <dc:creator>
90
+ <cc:Agent>
91
+ <dc:title>Jakub Steiner</dc:title>
92
+ </cc:Agent>
93
+ </dc:creator>
94
+ <dc:subject>
95
+ <rdf:Bag>
96
+ <rdf:li>emblem</rdf:li>
97
+ <rdf:li>photos</rdf:li>
98
+ <rdf:li>pictures</rdf:li>
99
+ <rdf:li>raw</rdf:li>
100
+ <rdf:li>jpeg</rdf:li>
101
+ </rdf:Bag>
102
+ </dc:subject>
103
+ </cc:Work>
104
+ <cc:License
105
+ rdf:about="http://creativecommons.org/licenses/publicdomain/">
106
+ <cc:permits
107
+ rdf:resource="http://creativecommons.org/ns#Reproduction" />
108
+ <cc:permits
109
+ rdf:resource="http://creativecommons.org/ns#Distribution" />
110
+ <cc:permits
111
+ rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
112
+ </cc:License>
113
+ </rdf:RDF>
114
+ </metadata>
115
+ <g
116
+ id="layer1"
117
+ inkscape:label="Layer 1"
118
+ inkscape:groupmode="layer"
119
+ transform="translate(0,-32)">
120
+ <path
121
+ transform="matrix(0.25916113,0,0,0.26887949,1.8391671,33.545719)"
122
+ d="m 46.138718,23.42804 c 0,11.715728 -9.853631,21.213203 -22.0087,21.213203 -12.155069,0 -22.0086992,-9.497475 -22.0086992,-21.213203 0,-11.715729 9.8536302,-21.2132039 22.0086992,-21.2132039 12.155069,0 22.0087,9.4974749 22.0087,21.2132039 z"
123
+ sodipodi:ry="21.213203"
124
+ sodipodi:rx="22.008699"
125
+ sodipodi:cy="23.42804"
126
+ sodipodi:cx="24.130018"
127
+ id="path3591"
128
+ style="fill:#ffffff;fill-opacity:0.76687112999999985;fill-rule:nonzero;stroke:none;opacity:0.67307692"
129
+ sodipodi:type="arc" />
130
+ <path
131
+ sodipodi:type="arc"
132
+ style="fill:#007900;fill-opacity:1;fill-rule:nonzero;stroke:#004900;stroke-width:4.64271878999999998;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;opacity:0.67307692"
133
+ id="path1650"
134
+ sodipodi:cx="24.130018"
135
+ sodipodi:cy="23.42804"
136
+ sodipodi:rx="22.008699"
137
+ sodipodi:ry="21.213203"
138
+ d="m 46.138718,23.42804 c 0,11.715728 -9.853631,21.213203 -22.0087,21.213203 -12.155069,0 -22.0086992,-9.497475 -22.0086992,-21.213203 0,-11.715729 9.8536302,-21.2132039 22.0086992,-21.2132039 12.155069,0 22.0087,9.4974749 22.0087,21.2132039 z"
139
+ transform="matrix(0.21812151,0,0,0.2263009,2.8294541,34.543252)" />
140
+ <path
141
+ sodipodi:type="arc"
142
+ style="fill:none;stroke:#00db05;stroke-width:2.11304854999999980;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;opacity:0.67307692"
143
+ id="path3392"
144
+ sodipodi:cx="24.130018"
145
+ sodipodi:cy="23.42804"
146
+ sodipodi:rx="22.008699"
147
+ sodipodi:ry="21.213203"
148
+ d="m 46.138718,23.42804 c 0,11.715728 -9.853631,21.213203 -22.0087,21.213203 -12.155069,0 -22.0086992,-9.497475 -22.0086992,-21.213203 0,-11.715729 9.8536302,-21.2132039 22.0086992,-21.2132039 12.155069,0 22.0087,9.4974749 22.0087,21.2132039 z"
149
+ transform="matrix(0.19478396,0,0,0.20208831,3.4225467,35.090879)" />
150
+ <path
151
+ style="fill:#fffeff;fill-opacity:0.21390375000000000;fill-rule:nonzero;stroke:none;opacity:0.67307692"
152
+ d="m 12.257886,39.645783 c 0,2.327923 -1.300846,-0.92557 -4.0139308,0.08306 -2.7345652,1.016607 -4.4205725,2.244872 -4.4205725,-0.08306 0,-2.327922 1.8893287,-4.217251 4.2172524,-4.217251 2.3279219,0 4.2172509,1.889329 4.2172509,4.217251 z"
153
+ id="path3068"
154
+ sodipodi:nodetypes="czssc" />
155
+ </g>
156
+ </svg>
@@ -0,0 +1,26 @@
1
+ module Merrol
2
+ class Controller
3
+
4
+ def initialize commands, views
5
+ @commands = commands
6
+ @views = views
7
+
8
+ @commands.register(self)
9
+ end
10
+
11
+ def method_missing(meth, *args, &block)
12
+ method = meth.to_s
13
+ if method =~ /_view$/
14
+ view = @views[method.gsub(/_view$/, '').to_sym]
15
+ view || super
16
+ else
17
+ super
18
+ end
19
+ end
20
+
21
+ def name
22
+ self.class.to_s.demodulize.underscore.gsub(/_controller$/, '').to_sym
23
+ end
24
+ end
25
+ end
26
+
@@ -0,0 +1,24 @@
1
+ module Merrol
2
+ class EditController < Controller
3
+ def select_all
4
+ edit_view.select_all(true)
5
+ end
6
+
7
+ def select_none
8
+ edit_view.select_all(false)
9
+ end
10
+
11
+ def undo
12
+ edit_view.undo
13
+ end
14
+
15
+ def redo
16
+ edit_view.redo
17
+ end
18
+
19
+ def delete
20
+ edit_view.buffer.delete_selection true, true
21
+ end
22
+ end
23
+ end
24
+
@@ -0,0 +1,61 @@
1
+ module Merrol
2
+ class FileController < Controller
3
+ def initialize commands, views
4
+ super commands, views
5
+ @source_models = {}
6
+ end
7
+
8
+ def switch
9
+ return if file_list_view.empty?
10
+ file_list_view.show if @second_switch
11
+ @second_switch = true
12
+ file_list_view.next
13
+ edit_view.buffer = @source_models[file_list_view.selected]
14
+ edit_view.scroll_to_cursor
15
+ self.handler_id = main_view.signal_connect('key_release_event') do |widget, event|
16
+ if event.keyval == Gdk::Keyval::GDK_Control_L
17
+ @second_switch = false
18
+ file_list_view.hide
19
+ main_view.signal_handler_disconnect(handler_id)
20
+ file_list_view.selected_to_top
21
+ true
22
+ else
23
+ false
24
+ end
25
+ end
26
+ end
27
+
28
+ def save
29
+ edit_view.buffer.save
30
+ end
31
+
32
+ def load path
33
+ model = SourceModel.new(path)
34
+ @source_models[path] = model
35
+ model.style_scheme = edit_view.theme
36
+ model.highlight_matching_brackets = edit_view.highlight_brackets
37
+ model.modified = false
38
+ model.place_cursor model.start_iter
39
+ model.signal_connect('modified_changed') do
40
+ if model.modified?
41
+ file_status_view.file = File.app_relative('data/images/modified.svg')
42
+ else
43
+ file_status_view.file = File.app_relative('data/images/saved.svg')
44
+ end
45
+ end
46
+ edit_view.buffer = model
47
+ file_list_view.prepend path
48
+ end
49
+
50
+ def load_all paths
51
+ paths.each do |path|
52
+ load path
53
+ end
54
+ end
55
+
56
+ private
57
+ attr_accessor :handler_id
58
+
59
+ end
60
+ end
61
+
@@ -0,0 +1,6 @@
1
+ module Merrol
2
+ class HelpController < Controller
3
+
4
+ end
5
+ end
6
+
@@ -0,0 +1,26 @@
1
+ module Merrol
2
+ class MainController < Controller
3
+ def initialize commands, views
4
+ super commands, views
5
+ main_view.signal_connect('destroy') { Gtk.main_quit}
6
+ end
7
+
8
+ def working_dir= working_dir
9
+ name = File.basename(working_dir)
10
+ main_view.title = "#{name} (#{working_dir[0..-name.length - 2]})"
11
+ end
12
+
13
+ def numbers
14
+
15
+ end
16
+
17
+ def quit
18
+ main_view.destroy
19
+ end
20
+
21
+ def cancel
22
+ end
23
+
24
+ end
25
+ end
26
+
@@ -0,0 +1,5 @@
1
+ module Merrol
2
+ class SearchController < Controller
3
+ end
4
+ end
5
+
@@ -0,0 +1,28 @@
1
+ module Merrol
2
+ class ToolsController < Controller
3
+ def complete
4
+
5
+ end
6
+
7
+ def test
8
+
9
+ end
10
+
11
+ def diff
12
+
13
+ end
14
+
15
+ def snippets
16
+
17
+ end
18
+
19
+ def reload
20
+
21
+ end
22
+
23
+ def error
24
+
25
+ end
26
+ end
27
+ end
28
+
@@ -0,0 +1,11 @@
1
+ module Gtk
2
+ class Bin
3
+ attr_reader :container
4
+
5
+ def container= widget
6
+ @container = eval(widget).new
7
+ self.add(@container)
8
+ end
9
+ end
10
+ end
11
+
@@ -0,0 +1,8 @@
1
+ module Gtk
2
+ class Image
3
+ def file= path
4
+ set_file File.app_relative(path)
5
+ end
6
+ end
7
+ end
8
+
@@ -0,0 +1,43 @@
1
+ module Gtk
2
+ class ListView < TreeView
3
+ def initialize
4
+ super
5
+ self.headers_visible = false
6
+ self.append_column(Gtk::TreeViewColumn.new('Name', Gtk::CellRendererText.new, "text" => 0))
7
+ self.model = Gtk::ListStore.new String
8
+ end
9
+
10
+ def list= items
11
+ items.each do |item|
12
+ iter = self.model.append
13
+ self.model.set_value iter, 0, item
14
+ end
15
+ selection.select_iter(self.model.iter_first) if items.any?
16
+ end
17
+
18
+ def prepend item
19
+ iter = self.model.prepend
20
+ self.model.set_value iter, 0, item
21
+ selection.select_iter iter
22
+ end
23
+
24
+ def selected
25
+ selection.selected[0] if selection.selected
26
+ end
27
+
28
+ def next
29
+ iter = selection.selected
30
+ iter.next!
31
+ selection.select_iter iter
32
+ end
33
+
34
+ def selected_to_top
35
+ self.model.move_before selection.selected, self.model.iter_first
36
+ end
37
+
38
+ def empty?
39
+ self.model.iter_first.nil?
40
+ end
41
+ end
42
+ end
43
+
@@ -0,0 +1,22 @@
1
+ module Gtk
2
+ class SourceView
3
+ attr_reader :theme, :highlight_brackets
4
+
5
+ def theme= path
6
+ name = File.basename(path)
7
+ path = path[0..-name.length - 2]
8
+ manager = SourceStyleSchemeManager.new
9
+ manager.prepend_search_path(File.app_relative(path))
10
+ @theme = manager.get_scheme(name.downcase)
11
+ end
12
+
13
+ def highlight_matching_brackets= on
14
+ @highlight_brackets = on
15
+ end
16
+
17
+ def scroll_to_cursor
18
+ scroll_mark_onscreen buffer.selection_bound
19
+ end
20
+ end
21
+ end
22
+
@@ -0,0 +1,12 @@
1
+ module Gtk
2
+ class Widget
3
+ def font= font
4
+ self.modify_font(Pango::FontDescription.new(font))
5
+ end
6
+
7
+ def initially_hidden= hidden
8
+ self.no_show_all = hidden
9
+ end
10
+ end
11
+ end
12
+
@@ -0,0 +1,18 @@
1
+ module Gtk
2
+ class Window
3
+ def icon= path
4
+ set_icon File.app_relative(path)
5
+ end
6
+
7
+ def default_position= coords
8
+ coords = coords.split(',')
9
+ move coords[0].to_i, coords[1].to_i
10
+ end
11
+
12
+ def default_size= size
13
+ size = size.split(',')
14
+ set_default_size size[0].to_i, size[1].to_i
15
+ end
16
+ end
17
+ end
18
+