Develop and Download Open Source Software

Browse CVS Repository

Annotation of /exerb/exerb-studio/exerb-studio.rb

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (hide annotations) (download)
Thu Jun 12 04:04:00 2003 UTC (20 years, 10 months ago) by yuya
Branch: MAIN
Changes since 1.2: +14 -22 lines
* XMLからデータを読み込むように変更

1 yuya 1.1 #! /usr/bin/ruby -Ks
2    
3 yuya 1.3 # $Id: exerb-studio.rb,v 1.2 2003/06/06 01:39:26 yuya Exp $
4 yuya 1.2
5 yuya 1.3 require 'uconv'
6     require 'rexml/document'
7 yuya 1.1 require 'vr/vruby'
8     require 'vr/vrcontrol'
9     require 'vr/vrcomctl'
10     require 'vr/vrdialog'
11 yuya 1.3 require 'vrext/vrext'
12    
13 yuya 1.1 require 'form/form'
14     require 'model/model'
15 yuya 1.3 #require 'node/node'
16 yuya 1.1
17     #EDITOR = '/home/yuya/bin/hidemaru'
18     EDITOR = '/home/yuya/bin/rde'
19    
20     class MainForm < VRForm
21    
22     include VRMenuUseable
23     include VRStatusbarDockable
24    
25     def construct
26     self.caption = 'Exerb Studio'
27     self.move(50, 50, 300, 450)
28     self.create_menu
29     self.create_controls
30     end
31    
32     def create_menu
33     menu = newMenu.set(
34     [
35     [
36     "&File",
37     [
38     ["Open Project...", "menu_file_open"],
39     ["E&xit", "menu_file_exit"],
40     ]
41     ],
42     [
43     "&Build",
44     [
45     ["&Build", "menu_build_build"],
46     ]
47     ],
48     [
49     "&Help",
50     [
51     ["&About", "menu_help_about"],
52     ]
53     ],
54     ]
55     )
56     self.setMenu(menu)
57     end
58     protected :create_menu
59    
60     def create_controls
61     @imglist = VRLocalScreen.factory.newimagelist(16, 16)
62 yuya 1.3 @imglist.addicon('res/folder_close.ico')
63     @imglist.addicon('res/folder_open.ico')
64     @imglist.addicon('mail.ico')
65 yuya 1.1
66     self.addStatusbar("status bar")
67    
68     cx, cy, cw, ch = self.clientrect
69     self.addControl(VRStatic, 'line1', '', cx, cy, cw, 0, WStyle::SS_ETCHEDHORZ)
70     @lab1 = self.addControl(VRStatic, 'lab1', '', cx + 5, cy + 5, cw, 16)
71     @lab2 = self.addControl(VRStatic, 'lab2', '', cx + 5, cy + 21, cw, 16)
72     @tree = self.addControl(VRTreeview, 'tree', '', cx, cy + 38, cw, ch - 38 - 20, WStyle::WS_BORDER)
73     @tree.setImagelist(@imglist)
74    
75     font = @screen.factory.newfont("Terminal", 14)
76     [@lab1, @lab2, @tree].each { |ctrl| ctrl.setFont(font) }
77    
78 yuya 1.3 project = Model::Project.loadxml('sample.xml')
79     project.create_node(@tree, WConst::TVI_ROOT)
80 yuya 1.1 end
81     protected :create_controls
82    
83     def menu_file_exit_clicked
84     self.close
85     end
86    
87     def menu_help_about_clicked
88     VRLocalScreen.openModalDialog(self, nil, Form::About)
89     end
90    
91     def tree_selchanged(hitem, lparam)
92 yuya 1.3 @tree_selected_item = Model::Store.get(@tree.getItemLParamOf(hitem))
93 yuya 1.1 if @tree_selected_item
94     @lab1.caption = @tree_selected_item.name
95 yuya 1.3 @lab2.caption = (@tree_selected_item.kind_of?(Model::File) ? @tree_selected_item.filepath : '')
96 yuya 1.1 end
97     end
98    
99     def tree_clicked
100     end
101    
102     def tree_dblclicked
103 yuya 1.3 if @tree_selected_item && @tree_selected_item.kind_of?(Model::File)
104 yuya 1.1 editor(@tree_selected_item.filepath)
105     end
106     end
107    
108     def editor(filepath)
109     system(EDITOR + ' "' + filepath + '" &')
110     end
111    
112     end
113    
114     VRLocalScreen.showForm(MainForm)
115     VRLocalScreen.messageloop

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