redcar 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. data/CHANGES +28 -0
  2. data/README.md +7 -0
  3. data/ROADMAP.md +11 -1
  4. data/Rakefile +61 -2
  5. data/bin/redcar +2 -1
  6. data/lib/redcar.rb +4 -3
  7. data/lib/redcar/installer.rb +3 -1
  8. data/lib/redcar/runner.rb +1 -1
  9. data/lib/redcar/usage.rb +4 -7
  10. data/lib/redcar_quick_start.rb +39 -5
  11. data/plugins/application/features/step_definitions/tree_steps.rb +6 -0
  12. data/plugins/application/features/support/env.rb +2 -6
  13. data/plugins/application/icons/redcar_icon_beta_dev.png +0 -0
  14. data/plugins/application/lib/application/command/executor.rb +8 -0
  15. data/plugins/application/lib/application/dialog.rb +25 -2
  16. data/plugins/application/lib/application/notebook.rb +4 -0
  17. data/plugins/application/lib/application/window.rb +4 -0
  18. data/plugins/application_swt/lib/application_swt.rb +2 -0
  19. data/plugins/application_swt/lib/application_swt/dialog_adapter.rb +28 -1
  20. data/plugins/application_swt/lib/application_swt/menu.rb +4 -0
  21. data/plugins/application_swt/lib/application_swt/menu/binding_translator.rb +4 -0
  22. data/plugins/application_swt/lib/application_swt/notebook.rb +22 -1
  23. data/plugins/application_swt/lib/application_swt/notebook/tab_drag_and_drop_listener.rb +124 -0
  24. data/plugins/application_swt/lib/application_swt/notebook/tab_transfer.rb +83 -0
  25. data/plugins/application_swt/lib/application_swt/swt_wrapper.rb +14 -0
  26. data/plugins/application_swt/lib/application_swt/tab.rb +28 -6
  27. data/plugins/application_swt/lib/application_swt/window.rb +88 -43
  28. data/plugins/application_swt/spec/application_swt/menu/binding_translator_spec.rb +11 -0
  29. data/plugins/application_swt/spec/spec_helper.rb +1 -1
  30. data/plugins/auto_completer/lib/auto_completer.rb +3 -20
  31. data/plugins/auto_pairer/lib/auto_pairer/document_controller.rb +1 -1
  32. data/plugins/declarations/lib/declarations/parser.rb +2 -2
  33. data/plugins/declarations/spec/spec_helper.rb +1 -0
  34. data/plugins/edit_view/features/step_definitions/notebook_steps.rb +3 -3
  35. data/plugins/edit_view/features/step_definitions/window_steps.rb +24 -9
  36. data/plugins/edit_view/features/support/env.rb +11 -9
  37. data/plugins/edit_view/lib/edit_view.rb +106 -6
  38. data/plugins/edit_view/lib/edit_view/info_speedbar.rb +32 -3
  39. data/plugins/edit_view/lib/edit_view/select_font_dialog.rb +39 -0
  40. data/plugins/edit_view/lib/edit_view/select_theme_dialog.rb +34 -0
  41. data/plugins/edit_view/lib/edit_view/tab_settings.rb +103 -8
  42. data/plugins/edit_view_swt/lib/edit_view_swt.rb +40 -3
  43. data/plugins/edit_view_swt/lib/edit_view_swt/edit_tab.rb +1 -1
  44. data/plugins/execute_current_tab/lib/execute_current_tab.rb +15 -6
  45. data/plugins/project/features/open_directory_tree.feature +10 -0
  46. data/plugins/project/lib/project.rb +10 -8
  47. data/plugins/project/lib/project/dir_mirror.rb +6 -5
  48. data/plugins/project/lib/project/drb_service.rb +16 -0
  49. data/plugins/project/lib/project/manager.rb +31 -5
  50. data/plugins/redcar/redcar.rb +115 -19
  51. data/plugins/tree_view_swt/lib/tree_view_swt.rb +15 -0
  52. data/textmate/Bundles/Cucumber.tmbundle/Preferences/Cucumber_Plain_Text_Feature_Completions.tmPreferences +3 -3
  53. data/textmate/Bundles/Cucumber.tmbundle/Preferences/Symbol_list___Scenario.tmPreferences +1 -1
  54. data/textmate/Bundles/Cucumber.tmbundle/Syntaxes/Cucumber_Plain_Text_Feature.tmLanguage +18 -76
  55. data/textmate/Bundles/Cucumber.tmbundle/Syntaxes/Cucumber_Steps.tmLanguage +1 -1
  56. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/Animation_animateStyle.tmSnippet +23 -0
  57. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/Event_listen.tmSnippet +16 -0
  58. data/textmate/Bundles/{Cucumber.tmbundle/Snippets/When_Step_Plaintext.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/Event_stop.tmSnippet} +5 -5
  59. data/textmate/Bundles/{Cucumber.tmbundle/Snippets/Then_Step.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/Event_stopListening.tmSnippet} +5 -9
  60. data/textmate/Bundles/{Cucumber.tmbundle/Snippets/Cucumber_Multiline_Steps.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/List_Model.tmSnippet} +10 -7
  61. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/Log_addLoggingMethodsToPrototype.tmSnippet +16 -0
  62. data/textmate/Bundles/{Cucumber.tmbundle/Snippets/Then_Step_Plaintext.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/Log_info.tmSnippet} +5 -5
  63. data/textmate/Bundles/{Cucumber.tmbundle/Snippets/Scenario___heading_only__.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/Log_logProperties.tmSnippet} +5 -7
  64. data/textmate/Bundles/{Cucumber.tmbundle/Snippets/When_Step.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/Model.tmSnippet} +7 -9
  65. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/__L____.tmSnippet +16 -0
  66. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/_insert____.tmSnippet +16 -0
  67. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/_update____.tmSnippet +16 -0
  68. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/controller_get.tmSnippet +16 -0
  69. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/controller_pushScene.tmSnippet +16 -0
  70. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Snippets/controller_serviceRequest.tmSnippet +21 -0
  71. data/textmate/Bundles/{Cucumber.tmbundle/Snippets/Scenario_Outline.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/controller_setupWidget.tmSnippet} +5 -9
  72. data/textmate/Bundles/{Cucumber.tmbundle/Snippets/Given_Step.tmSnippet → Palm-WebOS-Development.tmbundle/Snippets/controller_showBanner.tmSnippet} +5 -9
  73. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/Syntaxes/Mojo.tmLanguage +713 -0
  74. data/textmate/Bundles/Palm-WebOS-Development.tmbundle/info.plist +188 -0
  75. data/textmate/Bundles/Smalltalk.tmbundle/Preferences/GNU_Smalltalk.tmPreferences +32 -0
  76. data/textmate/Bundles/{asciidoc.tmbundle/Preferences/Symbol_List___Heading.tmPreferences → Smalltalk.tmbundle/Preferences/GNU___Symbol_List___Method.tmPreferences} +7 -6
  77. data/textmate/Bundles/{Cucumber.tmbundle/Preferences/next_Symbol_list___Scenario.tmPreferences → Smalltalk.tmbundle/Preferences/GNU___Symbol_List___Section.tmPreferences} +7 -4
  78. data/textmate/Bundles/{asciidoc.tmbundle/Snippets/Bold.tmSnippet → Smalltalk.tmbundle/Preferences/MIST_Smalltalk_Format.tmPreferences} +8 -7
  79. data/textmate/Bundles/Smalltalk.tmbundle/Syntaxes/GNU_Smalltalk.tmLanguage +493 -0
  80. data/textmate/Bundles/Smalltalk.tmbundle/Syntaxes/GNU_Smalltalk_2.tmLanguage +807 -0
  81. data/textmate/Bundles/Smalltalk.tmbundle/Syntaxes/MIST_Smalltalk_Format.tmLanguage +645 -0
  82. data/textmate/Bundles/Smalltalk.tmbundle/info.plist +21 -0
  83. data/textmate/Themes/Twilight.tmTheme +4 -0
  84. metadata +2604 -2586
  85. data/textmate/Bundles/Cucumber.tmbundle/Preferences/next_Cucumber_Plain_Text_Feature_Completions.tmPreferences +0 -30
  86. data/textmate/Bundles/Cucumber.tmbundle/Syntaxes/next_Cucumber_Plain_Text_Feature.tmLanguage +0 -221
  87. data/textmate/Bundles/Cucumber.tmbundle/Syntaxes/next_Cucumber_Steps.tmLanguage +0 -424
  88. data/textmate/Bundles/asciidoc.tmbundle/Preferences/Typing_Pairs___Defaults.tmPreferences +0 -54
  89. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Anchor.tmSnippet +0 -16
  90. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Comment_Block.tmSnippet +0 -19
  91. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Example_Block.tmSnippet +0 -19
  92. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Italic.tmSnippet +0 -16
  93. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Listing_Block.tmSnippet +0 -20
  94. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Literal_Block.tmSnippet +0 -19
  95. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Passthrough_Block.tmSnippet +0 -19
  96. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Quote_Block.tmSnippet +0 -19
  97. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Quoted.tmSnippet +0 -16
  98. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Sidebar_Block.tmSnippet +0 -19
  99. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Subscript.tmSnippet +0 -16
  100. data/textmate/Bundles/asciidoc.tmbundle/Snippets/Superscript.tmSnippet +0 -16
  101. data/textmate/Bundles/asciidoc.tmbundle/Syntaxes/AsciiDoc.tmLanguage +0 -428
  102. data/textmate/Bundles/asciidoc.tmbundle/info.plist +0 -91
@@ -42,6 +42,17 @@ describe BindingTranslator do
42
42
  check("Tab", Swt::SWT::TAB)
43
43
  end
44
44
 
45
+ it "translates home" do
46
+ check("Home", Swt::SWT::HOME)
47
+ check("Alt+Home", Swt::SWT::ALT + Swt::SWT::HOME)
48
+ check("Shift+Home", Swt::SWT::SHIFT + Swt::SWT::HOME)
49
+ end
50
+
51
+ it "translates end" do
52
+ check("End", Swt::SWT::END)
53
+ check("Ctrl+End", Swt::SWT::CTRL + Swt::SWT::END)
54
+ check("Cmd+End", Swt::SWT::COMMAND + Swt::SWT::END)
55
+ end
45
56
  end
46
57
 
47
58
  describe "multiple modifiers" do
@@ -1,7 +1,7 @@
1
1
  $:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
2
2
 
3
3
  require 'redcar'
4
-
4
+ Redcar.environment = :test
5
5
  Redcar.load
6
6
 
7
7
  Spec::Runner.configure do |config|
@@ -1,14 +1,4 @@
1
1
 
2
- module Redcar
3
- class ApplicationSWT
4
- class Menu
5
- def move(x, y)
6
- @menu_bar.setLocation(x, y)
7
- end
8
- end
9
- end
10
- end
11
-
12
2
  require 'auto_completer/current_document_completion_source'
13
3
  require 'auto_completer/document_controller'
14
4
  require 'auto_completer/word_iterator'
@@ -144,18 +134,11 @@ module Redcar
144
134
  end
145
135
  end
146
136
 
147
- window = Redcar.app.focussed_window
148
- location = window.focussed_notebook.focussed_tab.controller.edit_view.mate_text.viewer.getTextWidget.getLocationAtOffset(window.focussed_notebook.focussed_tab.controller.edit_view.cursor_offset)
149
- absolute_x = location.x
150
- absolute_y = location.y
151
- location = window.focussed_notebook.focussed_tab.controller.edit_view.mate_text.viewer.getTextWidget.toDisplay(0,0)
152
- absolute_x += location.x
153
- absolute_y += location.y
154
- menu = ApplicationSWT::Menu.new(window.controller, builder.menu, nil, Swt::SWT::POP_UP)
155
- menu.move(absolute_x, absolute_y)
156
- menu.show
137
+ Application::Dialog.popup_menu(builder.menu, :cursor)
157
138
  end
158
139
  end
159
140
  end
160
141
  end
161
142
  end
143
+
144
+
@@ -71,7 +71,7 @@ module Redcar
71
71
  # Type over ends
72
72
  if @rules = PairsForScope.pairs_for_scope(cursor_scope)
73
73
  inverse_rules = @rules.invert
74
- if inverse_rules.include?(text) and !@ignore_insert
74
+ if !@ignore_insert
75
75
  end_mark_pair = find_mark_pair_by_end(start_offset)
76
76
  if end_mark_pair and end_mark_pair.text == text
77
77
  @type_over_end = true
@@ -16,7 +16,7 @@ module Redcar
16
16
  - regex: "^[^#]*(class|module)\\s+(?:\\w*::)*(\\w+)(?:$|\\s|<)"
17
17
  capture: 2
18
18
  type: id
19
- - regex: "^[^#]*def (self\\.)?(\\w+)"
19
+ - regex: "^[^#]*def (self\\.)?(\\w+[?!]?)"
20
20
  capture: 2
21
21
  type: id
22
22
  - regex: "^[^#]*attr(_reader|_accessor|_writer)(.*)$"
@@ -25,7 +25,7 @@ module Redcar
25
25
  - regex: "^[^#]*alias\s+:(\\w+)"
26
26
  capture: 1
27
27
  type: id
28
- - regex: "^[^#]*alias_method\s+:(\\w+)"
28
+ - regex: "^[^#]*alias_method\s+:(\\w+[?!]?)"
29
29
  capture: 1
30
30
  type: id
31
31
  - regex: "^\\s*([A-Z]\\w*)\\s*="
@@ -1,4 +1,5 @@
1
1
  $:.push File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')
2
2
 
3
3
  require 'redcar'
4
+ Redcar.environment = :test
4
5
  Redcar.load
@@ -1,11 +1,11 @@
1
1
 
2
2
  module NotebookSwtHelper
3
- def sash
4
- sash = active_shell.children.to_a.first
3
+ def notebook_sash
4
+ active_shell.children.to_a.last.children.to_a[0]
5
5
  end
6
6
 
7
7
  def ctab_folders
8
- sash.children.to_a[1].children.to_a[0].children.to_a.select do |c|
8
+ notebook_sash.children.to_a.select do |c|
9
9
  c.class == Java::OrgEclipseSwtCustom::CTabFolder
10
10
  end
11
11
  end
@@ -26,7 +26,23 @@ When /I open a new window(?: with title "(.*)")?/ do |title|
26
26
  end
27
27
 
28
28
  class FakeEvent
29
- attr_accessor :doit
29
+ def initialize(event_type, widget)
30
+ untyped_event = Swt::Widgets::Event.new.tap do |e|
31
+ e.display = Swt.display
32
+ e.widget = widget
33
+ e.x = 0
34
+ e.y = 0
35
+ end
36
+ widget.notify_listeners(event_type, untyped_event)
37
+ end
38
+ end
39
+
40
+ When /^I maximize the window size$/ do
41
+ Redcar.app.focussed_window.controller.shell.maximized = true
42
+ end
43
+
44
+ When /^I restore the window size$/ do
45
+ Redcar.app.focussed_window.controller.shell.maximized = false
30
46
  end
31
47
 
32
48
  When /I close the window(?: "(.*)")?( with a command| through the gui)?/ do |title, how|
@@ -43,8 +59,8 @@ When /I close the window(?: "(.*)")?( with a command| through the gui)?/ do |tit
43
59
  shell = display.get_active_shell
44
60
  win = Redcar.app.windows.detect {|w| w.controller.shell == shell }
45
61
  end
46
- win.controller.shell_listener.shell_closed(FakeEvent.new)
47
- end
62
+ FakeEvent.new(Swt::SWT::Close, win.controller.shell)
63
+ end
48
64
  end
49
65
 
50
66
  When /^I focus the window "([^\"]*)" with a command$/ do |title|
@@ -54,7 +70,7 @@ end
54
70
 
55
71
  When /^I focus the window "([^\"]*)" through the gui$/ do |title|
56
72
  win = Redcar.app.windows.detect{|win| win.title == title }
57
- win.controller.shell_listener.shell_activated(FakeEvent.new)
73
+ FakeEvent.new(Swt::SWT::Activate, win.controller.shell)
58
74
  end
59
75
 
60
76
  Then /^the window should be titled "([^\"]*)"$/ do |title|
@@ -75,10 +91,9 @@ Then /the window "(.*)" should have (\d+) tabs?/ do |win_title, tab_num|
75
91
 
76
92
  # in the GUI
77
93
  display = Swt::Widgets::Display.get_current
78
- shells = display.get_shells.to_a
79
- shell = shells.detect {|s| s.text == win_title}
80
- sash_form = shell.children.to_a.first
81
- tab_folders = sash_form.children.to_a[1].children.to_a[0].children.to_a.select{|c| c.is_a? Swt::Custom::CTabFolder}
82
- items = tab_folders.map{|f| f.getItems.to_a}.flatten
94
+ shells = display.get_shells.to_a
95
+ shell = shells.detect {|s| s.text == win_title }
96
+ items = get_tab_folders(shell).map{|f| f.getItems.to_a}.flatten
97
+
83
98
  items.map {|i| model_tab_for_item(i)}.length.should == tab_num
84
99
  end
@@ -1,12 +1,17 @@
1
1
  RequireSupportFiles File.dirname(__FILE__) + "/../../../application/features/"
2
2
 
3
3
  module SwtTabHelpers
4
+ def get_tab_folders(shell=active_shell)
5
+ right_composite = shell.children.to_a.last
6
+ notebook_sash_form = right_composite.children.to_a[0]
7
+ tab_folders = notebook_sash_form.children.to_a.select do |c|
8
+ c.class == Java::OrgEclipseSwtCustom::CTabFolder
9
+ end
10
+ end
11
+
4
12
  def get_tab_folder
5
- display = Redcar::ApplicationSWT.display
6
- sash_form = active_shell.children.to_a.first
7
- tab_folders = sash_form.children.to_a[1].children.to_a[0].children.to_a
8
- tab_folders.length.should == 1
9
- tab_folders.first
13
+ get_tab_folders.length.should == 1
14
+ get_tab_folders.first
10
15
  end
11
16
 
12
17
  def get_tab(tab_folder)
@@ -19,10 +24,7 @@ module SwtTabHelpers
19
24
  end
20
25
 
21
26
  def get_tabs
22
- display = Redcar::ApplicationSWT.display
23
- sash_form = active_shell.children.to_a.first
24
- tab_folders = sash_form.children.to_a[1].children.to_a[0].children.to_a.select{|c| c.is_a? Swt::Custom::CTabFolder}
25
- items = tab_folders.map{|f| f.getItems.to_a}.flatten
27
+ items = get_tab_folders.map{|f| f.getItems.to_a}.flatten
26
28
  items.map {|i| model_tab_for_item(i)}
27
29
  end
28
30
 
@@ -13,6 +13,8 @@ require "edit_view/edit_tab"
13
13
  require "edit_view/modified_tabs_checker"
14
14
  require "edit_view/tab_settings"
15
15
  require "edit_view/info_speedbar"
16
+ require "edit_view/select_font_dialog"
17
+ require "edit_view/select_theme_dialog"
16
18
 
17
19
  module Redcar
18
20
  class EditView
@@ -185,8 +187,8 @@ module Redcar
185
187
  default_font = "Courier New"
186
188
  default_font_size = 9
187
189
  end
188
- [ ARGV.option("font") || default_font,
189
- (ARGV.option("font-size") || default_font_size).to_i ]
190
+ [ EditView.storage["font"] || default_font,
191
+ EditView.storage["font-size"] || default_font_size ]
190
192
  end
191
193
 
192
194
  def self.font
@@ -197,10 +199,37 @@ module Redcar
197
199
  font_info[1]
198
200
  end
199
201
 
200
- def self.theme
201
- ARGV.option("theme") || "Twilight"
202
+ def self.font=(font)
203
+ EditView.storage["font"] = font
204
+ all_edit_views.each {|ev| ev.refresh_font }
202
205
  end
203
206
 
207
+ def refresh_font
208
+ notify_listeners(:font_changed)
209
+ end
210
+
211
+ def self.font_size=(size)
212
+ EditView.storage["font-size"] = size
213
+ all_edit_views.each {|ev| ev.refresh_font }
214
+ end
215
+
216
+ def self.theme
217
+ EditView.storage["theme"] || "Twilight"
218
+ end
219
+
220
+ def self.theme=(theme)
221
+ EditView.storage["theme"] = theme
222
+ all_edit_views.each {|ev| ev.refresh_theme }
223
+ end
224
+
225
+ def self.themes
226
+ @themes ||= []
227
+ end
228
+
229
+ def refresh_theme
230
+ notify_listeners(:theme_changed)
231
+ end
232
+
204
233
  def self.focussed_tab_edit_view
205
234
  Redcar.app.focussed_notebook_tab.edit_view if Redcar.app.focussed_notebook_tab and Redcar.app.focussed_notebook_tab.edit_tab?
206
235
  end
@@ -246,9 +275,14 @@ module Redcar
246
275
 
247
276
  def set_grammar(name)
248
277
  @grammar = name
249
- self.tab_width = EditView.tab_settings.width_for(name)
250
- self.soft_tabs = EditView.tab_settings.softness_for(name)
278
+ self.tab_width = EditView.tab_settings.width_for(name)
279
+ self.soft_tabs = EditView.tab_settings.softness_for(name)
280
+ self.word_wrap = EditView.tab_settings.word_wrap_for(name)
281
+ self.margin_column = EditView.tab_settings.margin_column_for(name)
282
+ self.show_margin = EditView.tab_settings.show_margin_for(name)
251
283
  refresh_show_invisibles
284
+ refresh_show_line_numbers
285
+ refresh_show_annotations
252
286
  end
253
287
 
254
288
  def focus
@@ -279,6 +313,36 @@ module Redcar
279
313
  notify_listeners(:softness_changed, bool)
280
314
  end
281
315
 
316
+ def show_margin?
317
+ @show_margin
318
+ end
319
+
320
+ def show_margin=(bool)
321
+ @show_margin = bool
322
+ EditView.tab_settings.set_show_margin_for(grammar, bool)
323
+ notify_listeners(:show_margin_changed, bool)
324
+ end
325
+
326
+ def word_wrap?
327
+ @word_wrap
328
+ end
329
+
330
+ def word_wrap=(bool)
331
+ @word_wrap = bool
332
+ EditView.tab_settings.set_word_wrap_for(grammar, bool)
333
+ notify_listeners(:word_wrap_changed, bool)
334
+ end
335
+
336
+ def margin_column
337
+ @margin_column
338
+ end
339
+
340
+ def margin_column=(val)
341
+ @margin_column = val
342
+ EditView.tab_settings.set_margin_column_for(grammar, val)
343
+ notify_listeners(:margin_column_changed, val)
344
+ end
345
+
282
346
  def show_invisibles?
283
347
  @show_invisibles
284
348
  end
@@ -297,6 +361,42 @@ module Redcar
297
361
  notify_listeners(:invisibles_changed, @show_invisibles)
298
362
  end
299
363
 
364
+ def show_line_numbers?
365
+ @show_line_numbers
366
+ end
367
+
368
+ def self.show_line_numbers?
369
+ EditView.tab_settings.show_line_numbers?
370
+ end
371
+
372
+ def self.show_line_numbers=(bool)
373
+ EditView.tab_settings.set_show_line_numbers(bool)
374
+ all_edit_views.each {|ev| ev.refresh_show_line_numbers }
375
+ end
376
+
377
+ def refresh_show_line_numbers
378
+ @show_line_numbers = EditView.tab_settings.show_line_numbers?
379
+ notify_listeners(:line_number_visibility_changed, @show_line_numbers)
380
+ end
381
+
382
+ def show_annotations?
383
+ @show_annotations
384
+ end
385
+
386
+ def self.show_annotations?
387
+ EditView.tab_settings.show_annotations?
388
+ end
389
+
390
+ def self.show_annotations=(bool)
391
+ EditView.tab_settings.set_show_annotations(bool)
392
+ all_edit_views.each {|ev| ev.refresh_show_annotations }
393
+ end
394
+
395
+ def refresh_show_annotations
396
+ @show_annotations = EditView.tab_settings.show_annotations?
397
+ notify_listeners(:annotations_visibility_changed, @show_annotations)
398
+ end
399
+
300
400
  def title=(title)
301
401
  notify_listeners(:title_changed, title)
302
402
  end
@@ -19,6 +19,20 @@ module Redcar
19
19
  @tab.edit_view.soft_tabs = new_value
20
20
  end
21
21
 
22
+ toggle :word_wrap, "Word Wrap", nil, false do |new_value|
23
+ @tab.edit_view.word_wrap = new_value
24
+ end
25
+
26
+ label :margin_column_label, "Margin:"
27
+
28
+ toggle :show_margin, "", nil, TabSettings::DEFAULT_MARGIN_PRESENT do |new_value|
29
+ @tab.edit_view.show_margin = new_value
30
+ end
31
+
32
+ textbox :margin_column, TabSettings::DEFAULT_MARGIN_COLUMN.to_s do |new_value|
33
+ @tab.edit_view.margin_column = [new_value.to_i, 5].max
34
+ end
35
+
22
36
  def initialize(command, tab)
23
37
  @command = command
24
38
  tab_changed(tab)
@@ -32,17 +46,29 @@ module Redcar
32
46
  @tab = new_tab
33
47
  grammar.items = InfoSpeedbar.grammar_names
34
48
  grammar.value = @tab.edit_view.grammar
35
- tab_width.value = @tab.edit_view.tab_width.to_s #EditView.tab_settings.width_for(@tab.edit_view.grammar).to_s
36
- soft_tabs.value = @tab.edit_view.soft_tabs? #EditView.tab_settings.softness_for(@tab.edit_view.grammar)
49
+ tab_width.value = @tab.edit_view.tab_width.to_s
50
+ soft_tabs.value = @tab.edit_view.soft_tabs?
51
+ word_wrap.value = @tab.edit_view.word_wrap?
52
+ show_margin.value = @tab.edit_view.show_margin?
53
+ margin_column.value = @tab.edit_view.margin_column.to_s
37
54
  @width_handler = @tab.edit_view.add_listener(:tab_width_changed) do |new_value|
38
55
  tab_width.value = new_value.to_s
39
56
  end
57
+ @margin_column_handler = @tab.edit_view.add_listener(:margin_column_changed) do |new_value|
58
+ margin_column.value = new_value.to_s
59
+ end
40
60
  @softness_handler = @tab.edit_view.add_listener(:softness_changed) do |new_value|
41
61
  soft_tabs.value = new_value
42
62
  end
63
+ @word_wrap_handler = @tab.edit_view.add_listener(:word_wrap_changed) do |new_value|
64
+ word_wrap.value = new_value
65
+ end
43
66
  @grammar_handler = @tab.edit_view.add_listener(:grammar_changed) do |new_grammar|
44
67
  grammar.value = new_grammar
45
68
  end
69
+ @show_margin_handler = @tab.edit_view.add_listener(:show_margin_changed) do |new_value|
70
+ show_margin.value = new_value
71
+ end
46
72
  end
47
73
  end
48
74
 
@@ -50,7 +76,10 @@ module Redcar
50
76
  @tab.edit_view.remove_listener(@width_handler)
51
77
  @tab.edit_view.remove_listener(@grammar_handler)
52
78
  @tab.edit_view.remove_listener(@softness_handler)
53
- end
79
+ @tab.edit_view.remove_listener(@word_wrap_handler)
80
+ @tab.edit_view.remove_listener(@margin_column_handler)
81
+ @tab.edit_view.remove_listener(@show_margin_handler)
82
+ end
54
83
 
55
84
  def close
56
85
  if @tab
@@ -0,0 +1,39 @@
1
+ module Redcar
2
+ class EditView
3
+ class SelectFontDialog < FilterListDialog
4
+
5
+ def initialize
6
+ super()
7
+ fontdata = Redcar.app.focussed_window.controller.shell.get_display.get_font_list(nil, true)
8
+ @matches = []
9
+ (0..(fontdata.length-1)).each do |i|
10
+ @matches << fontdata[i].get_name unless @matches.include?(fontdata[i].get_name)
11
+ end
12
+ @matches.sort!
13
+ end
14
+
15
+ def close
16
+ super
17
+ end
18
+
19
+ def update_list(filter)
20
+ @last_list = @matches
21
+ filtered_list = @last_list
22
+ if filter.length >= 1
23
+ filtered_list = filter_and_rank_by(filtered_list, filter, filtered_list.length) do |match|
24
+ match
25
+ end
26
+ end
27
+ filtered_list
28
+ end
29
+
30
+ def selected(text, ix, closing=false)
31
+ if @last_list
32
+ close
33
+ Redcar::EditView.font = text
34
+ end
35
+ end
36
+
37
+ end
38
+ end
39
+ end