Develop and Download Open Source Software

Browse Subversion Repository

Contents of /edmaru.rb

Parent Directory Parent Directory | Revision Log Revision Log


Revision 35 - (show annotations) (download)
Sat Apr 14 00:06:24 2007 UTC (16 years, 11 months ago) by bluedwarf
File size: 2284 byte(s)
Find file mode.

1 #!/usr/bin/ruby
2 #
3 # edmaru.rb: the main program of Edmaru.
4 #
5 # Copyright (C) 2007 Takashi Nakamoto
6 #
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License version 2 as
9 # published by the Free Software Foundation.
10 #
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 # 02110-1301 USA.
20 #
21
22 require "view.rb"
23 require "config/config_manager.rb"
24 require "buffer_manager.rb"
25 require "action_manager.rb"
26 require "event_manager.rb"
27 require "event_handler/all_event_handlers.rb"
28
29 # System selection
30 system = ARGV.shift
31 if system == nil || system == ""
32 system = "ncurses"
33 end
34
35 # System specific environment configuration.
36 case system
37 when "ncurses"
38 require "ncurses/ncurses_env.rb"
39 when "gtk"
40 require "gtk/gtk_env.rb"
41 end
42
43 begin
44 config = Edmaru::Config::ConfigManager.new
45
46 #Load user configuration.
47 begin
48 f = open("#{ENV['HOME']}/.edmaru.rb", "r")
49 begin
50 eval(f.read)
51 rescue => e
52 puts e
53 exit(1)
54 ensure
55 f.close
56 end
57 rescue
58 puts "Couldn't open #{ENV['HOME']}/.edmaru.rb"
59 end
60
61 action_mgr = Edmaru::ActionManager.new
62
63 event_mgr = Edmaru::EventManager.new
64 fundamental_event_handler =
65 Edmaru::FundamentalEventHandler.new(action_mgr)
66 event_mgr.set_current_handler(fundamental_event_handler)
67 action_mgr.event_manager = event_mgr
68
69 buffer_mgr = Edmaru::BufferManager.new
70 action_mgr.buffer_manager = buffer_mgr
71
72 view = Edmaru::SYSTEM_VIEW.new(config, event_mgr, buffer_mgr)
73 action_mgr.view = view
74
75 view.focused_window.buffer = buffer_mgr.get("*scratch*")
76 view.mini_window.buffer = buffer_mgr.get("*mini buffer*")
77 default_text = <<EOT
78 # This buffer is for notes you don't want to save.
79 # If you want to exit Edmaru, type C-x C-c.
80 EOT
81 view.focused_window.buffer.append(default_text)
82
83 view.main_loop
84 ensure
85 if view != nil
86 view.terminate
87 end
88 end

Properties

Name Value
svn:executable

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26