Class: UI_Elements
Instance Attribute Summary collapse
Instance Method Summary
collapse
#check_bounds, #color_to_hex, #draw_chevron, #hex_to_color, #pos_box, #relative_pos, #round_num_to_grid, #round_to_grid, #set_point_speed, #sync_diff
Constructor Details
Returns a new instance of UI_Elements.
68
69
70
71
72
73
74
75
76
|
# File 'lib/midinous/style/ui.rb', line 68
def initialize
@current_file = nil
@operation_file = nil
@current_window = nil
@scale_iters = []
@in_channel_items = []
@in_device_items = []
@out_device_items = []
end
|
Instance Attribute Details
#canvas_commands ⇒ Object
Construct a Gtk::Builder instance and load our UI description
66
67
68
|
# File 'lib/midinous/style/ui.rb', line 66
def canvas_commands
@canvas_commands
end
|
#in_channel_items ⇒ Object
Construct a Gtk::Builder instance and load our UI description
66
67
68
|
# File 'lib/midinous/style/ui.rb', line 66
def in_channel_items
@in_channel_items
end
|
#in_device_items ⇒ Object
Construct a Gtk::Builder instance and load our UI description
66
67
68
|
# File 'lib/midinous/style/ui.rb', line 66
def in_device_items
@in_device_items
end
|
#menu_commands ⇒ Object
Construct a Gtk::Builder instance and load our UI description
66
67
68
|
# File 'lib/midinous/style/ui.rb', line 66
def menu_commands
@menu_commands
end
|
#out_device_items ⇒ Object
Construct a Gtk::Builder instance and load our UI description
66
67
68
|
# File 'lib/midinous/style/ui.rb', line 66
def out_device_items
@out_device_items
end
|
Instance Method Details
#about_window ⇒ Object
93
94
95
|
# File 'lib/midinous/style/ui.rb', line 93
def about_window
@builder.get_object("about_window")
end
|
#build_ui ⇒ Object
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
|
# File 'lib/midinous/style/ui.rb', line 77
def build_ui
builder_file = "#{File.dirname(__FILE__)}/midinous.glade"
@builder = Gtk::Builder.new(:file => builder_file)
def midinous
@builder.get_object("midinous")
end
def file_chooser
@builder.get_object("file_chooser")
end
def confirmer
@builder.get_object("confirmer")
end
def about_window
@builder.get_object("about_window")
end
def notes_window
@builder.get_object("notes_window")
end
def scales_window
@builder.get_object("scales_window")
end
def hotkeys_window
@builder.get_object("hotkeys_window")
end
def
@builder.get_object("edit_menu")
end
def
@builder.get_object("input_menu")
end
def
@builder.get_object("output_menu")
end
def
@builder.get_object("input_channel_menu")
end
def
@builder.get_object("help_menu")
end
def file_new
@builder.get_object("file_new")
end
def file_open
@builder.get_object("file_open")
end
def file_save
@builder.get_object("file_save")
end
def file_save_as
@builder.get_object("file_save_as")
end
def file_quit
@builder.get_object("file_quit")
end
def edit_io
@builder.get_object("edit_io")
end
def help_about
@builder.get_object("help_about")
end
def help_notes
@builder.get_object("help_notes")
end
def help_scales
@builder.get_object("help_scales")
end
def help_hotkeys
@builder.get_object("help_hotkeys")
end
def canvas
@builder.get_object("canvas")
end
def canvas_viewport
@builder.get_object("canvas_viewport")
end
def canvas_scroll_window
@builder.get_object("canvas_scroll_window")
end
def canvas_h_adj
@builder.get_object("canvas_scroll_h")
end
def canvas_v_adj
@builder.get_object("canvas_scroll_v")
end
def tempo_adj
@builder.get_object("tempo_adj")
end
def root_adj
@builder.get_object("root_adj")
end
def main_tool_1
@builder.get_object("main_tool_1")
end
def main_tool_2
@builder.get_object("main_tool_2")
end
def main_tool_3
@builder.get_object("main_tool_3")
end
def main_tool_4
@builder.get_object("main_tool_4")
end
def path_builder
@builder.get_object("path_builder")
end
def prop_mod_button
@builder.get_object("prop_mod_button")
end
def play
@builder.get_object("play")
end
def stop
@builder.get_object("stop")
end
def tempo
@builder.get_object("tempo")
end
def root_select
@builder.get_object("root_select")
end
def file_operation
@builder.get_object("file_operation")
end
def file_cancel
@builder.get_object("file_cancel")
end
def confirmer_confirm
@builder.get_object("confirmer_confirm")
end
def confirmer_cancel
@builder.get_object("confirmer_cancel")
end
def logic_controls
@builder.get_object("logic_controls")
end
def tool_descrip
@builder.get_object("tool_descrip")
end
def status_area
@builder.get_object("status_area")
end
def prop_mod
@builder.get_object("prop_mod")
end
def t_sig
@builder.get_object("t_sig")
end
def file_name
@builder.get_object("file_name")
end
def perf_label
@builder.get_object("perf_label")
end
def tool_label
@builder.get_object("tool_label")
end
def tempo_label
@builder.get_object("tempo_label")
end
def property_label
@builder.get_object("property_label")
end
def modify_label
@builder.get_object("modify_label")
end
def t_sig_label
@builder.get_object("t_sig_label")
end
def confirmer_label
@builder.get_object("confirmer_label")
end
def scale_label
@builder.get_object("scale_label")
end
def prop_list_model
@builder.get_object("prop_list_model")
end
def prop_list_view
@builder.get_object("prop_list_view")
end
def prop_list
@builder.get_object("prop_list")
end
def prop_list_col1_h
@builder.get_object("prop_list_col1_h")
end
def prop_list_col2_h
@builder.get_object("prop_list_col2_h")
end
def prop_list_col1
@builder.get_object("prop_list_col1")
end
def prop_list_col2
@builder.get_object("prop_list_col2")
end
def prop_list_selection
@builder.get_object("prop_list_selection")
end
def scale_combo
@builder.get_object("scale_combo")
end
def scale_tree_model
@builder.get_object("scale_tree_model")
end
def scale_display
@builder.get_object("scale_display")
end
def
@in_channel_items.each {|i| .remove(i)}
@in_channel_items = []
@in_device_items.each {|i| .remove(i)}
@in_device_items = []
@out_device_items.each {|o| .remove(o)}
@out_device_items = []
end
def
unless Pm.in_list.length <= 1
16.times.with_index {|i| @in_channel_items << Gtk::ImageMenuItem.new(label: (i+1).to_s)}
@in_channel_items.each {|i| .append(i)}
Pm.in_list.each {|i| @in_device_items << Gtk::ImageMenuItem.new(label: i.name)}
@in_device_items.each {|i| .append(i)}
end
Pm.out_list.each {|o| @out_device_items << Gtk::ImageMenuItem.new(label: o.name)}
@out_device_items.each {|o| .append(o)}
.show_all
.show_all
.show_all
end
def set_device(id,type)
case type
when 'i'
Pm.sel_in(id)
when 'o'
Pm.sel_out(id)
end
regen_status
end
def regen_status
unless Pm.in_list.length <= 1
status_area.text = "Using: Output[#{Pm.out_list[Pm.out_id].name}] "\
"Input[#{Pm.in_list[Pm.in_id].name} Channel: #{Pm.in_chan}]"
else
status_area.text = "Using: Output[#{Pm.out_list[Pm.out_id].name}]"
end
end
@menu_commands = Gtk::AccelGroup.new
@canvas_commands = Gtk::AccelGroup.new
midinous.add_accel_group(@menu_commands)
midinous.add_accel_group(@canvas_commands)
scale_cat_1 = scale_tree_model.append(nil)
scale_cat_1_sub_01 = scale_tree_model.append(scale_cat_1)
scale_cat_1_sub_02 = scale_tree_model.append(scale_cat_1)
scale_cat_1_sub_03 = scale_tree_model.append(scale_cat_1)
scale_cat_1_sub_04 = scale_tree_model.append(scale_cat_1)
scale_cat_1_sub_05 = scale_tree_model.append(scale_cat_1)
scale_cat_1_sub_06 = scale_tree_model.append(scale_cat_1)
scale_cat_2 = scale_tree_model.append(nil)
scale_cat_2_sub_01 = scale_tree_model.append(scale_cat_2)
scale_cat_2_sub_02 = scale_tree_model.append(scale_cat_2)
scale_cat_2_sub_03 = scale_tree_model.append(scale_cat_2)
scale_cat_2_sub_04 = scale_tree_model.append(scale_cat_2)
scale_cat_2_sub_05 = scale_tree_model.append(scale_cat_2)
scale_cat_2_sub_06 = scale_tree_model.append(scale_cat_2)
scale_cat_2_sub_07 = scale_tree_model.append(scale_cat_2)
scale_cat_2_sub_08 = scale_tree_model.append(scale_cat_2)
scale_cat_2_sub_09 = scale_tree_model.append(scale_cat_2)
scale_cat_3 = scale_tree_model.append(nil)
scale_cat_3_sub_01 = scale_tree_model.append(scale_cat_3)
scale_cat_3_sub_02 = scale_tree_model.append(scale_cat_3)
scale_cat_3_sub_03 = scale_tree_model.append(scale_cat_3)
scale_cat_3_sub_04 = scale_tree_model.append(scale_cat_3)
scale_cat_3_sub_05 = scale_tree_model.append(scale_cat_3)
scale_cat_3_sub_06 = scale_tree_model.append(scale_cat_3)
scale_cat_4 = scale_tree_model.append(nil)
scale_cat_4_sub_01 = scale_tree_model.append(scale_cat_4)
scale_cat_4_sub_02 = scale_tree_model.append(scale_cat_4)
scale_cat_4_sub_03 = scale_tree_model.append(scale_cat_4)
scale_cat_4_sub_04 = scale_tree_model.append(scale_cat_4)
scale_cat_4_sub_05 = scale_tree_model.append(scale_cat_4)
scale_cat_4_sub_06 = scale_tree_model.append(scale_cat_4)
scale_cat_5 = scale_tree_model.append(nil)
scale_cat_5_sub_01 = scale_tree_model.append(scale_cat_5)
scale_cat_5_sub_02 = scale_tree_model.append(scale_cat_5)
scale_cat_5_sub_03 = scale_tree_model.append(scale_cat_5)
scale_cat_5_sub_04 = scale_tree_model.append(scale_cat_5)
scale_cat_5_sub_05 = scale_tree_model.append(scale_cat_5)
scale_cat_1 [0] = "Pentatonic"
scale_cat_1_sub_01[0] = "Hirajoshi"
scale_cat_1_sub_02[0] = "Insen"
scale_cat_1_sub_03[0] = "Iwato"
scale_cat_1_sub_04[0] = "Pentatonic Major"
scale_cat_1_sub_05[0] = "Pentatonic Minor"
scale_cat_1_sub_06[0] = "Two Semitone Tritone"
scale_cat_2 [0] = "Traditional"
scale_cat_2_sub_01[0] = "Aeolian"
scale_cat_2_sub_02[0] = "Dorian"
scale_cat_2_sub_03[0] = "Harmonic Major"
scale_cat_2_sub_04[0] = "Harmonic Minor"
scale_cat_2_sub_05[0] = "Ionian"
scale_cat_2_sub_06[0] = "Locrian"
scale_cat_2_sub_07[0] = "Lydian"
scale_cat_2_sub_08[0] = "Mixolydian"
scale_cat_2_sub_09[0] = "Phrygian"
scale_cat_3 [0] = "Modified Traditional"
scale_cat_3_sub_01[0] = "Altered"
scale_cat_3_sub_02[0] = "Half Diminished"
scale_cat_3_sub_03[0] = "Locrian Major"
scale_cat_3_sub_04[0] = "Lydian Augmented"
scale_cat_3_sub_05[0] = "Melodic Minor"
scale_cat_3_sub_06[0] = "Ukrainian Dorian"
scale_cat_4 [0] = "Exotic"
scale_cat_4_sub_01[0] = "Augmented"
scale_cat_4_sub_02[0] = "Blues"
scale_cat_4_sub_03[0] = "Flamenco"
scale_cat_4_sub_04[0] = "Hungarian"
scale_cat_4_sub_05[0] = "Persian"
scale_cat_4_sub_06[0] = "Prometheus"
scale_cat_5 [0] = "Mathematical"
scale_cat_5_sub_01[0] = "Chromatic"
scale_cat_5_sub_02[0] = "Octatonic Whole"
scale_cat_5_sub_03[0] = "Octatonic Half"
scale_cat_5_sub_04[0] = "Tritone"
scale_cat_5_sub_05[0] = "Whole Tone"
@scale_iters << scale_cat_1_sub_01
@scale_iters << scale_cat_1_sub_02
@scale_iters << scale_cat_1_sub_03
@scale_iters << scale_cat_1_sub_04
@scale_iters << scale_cat_1_sub_05
@scale_iters << scale_cat_1_sub_06
@scale_iters << scale_cat_2_sub_01
@scale_iters << scale_cat_2_sub_02
@scale_iters << scale_cat_2_sub_03
@scale_iters << scale_cat_2_sub_04
@scale_iters << scale_cat_2_sub_05
@scale_iters << scale_cat_2_sub_06
@scale_iters << scale_cat_2_sub_07
@scale_iters << scale_cat_2_sub_08
@scale_iters << scale_cat_2_sub_09
@scale_iters << scale_cat_3_sub_01
@scale_iters << scale_cat_3_sub_02
@scale_iters << scale_cat_3_sub_03
@scale_iters << scale_cat_3_sub_04
@scale_iters << scale_cat_3_sub_05
@scale_iters << scale_cat_3_sub_06
@scale_iters << scale_cat_4_sub_01
@scale_iters << scale_cat_4_sub_02
@scale_iters << scale_cat_4_sub_03
@scale_iters << scale_cat_4_sub_04
@scale_iters << scale_cat_4_sub_05
@scale_iters << scale_cat_4_sub_06
@scale_iters << scale_cat_5_sub_01
@scale_iters << scale_cat_5_sub_02
@scale_iters << scale_cat_5_sub_03
@scale_iters << scale_cat_5_sub_04
@scale_iters << scale_cat_5_sub_05
scale_combo.active = 4
scale_combo.active_iter = scale_cat_5_sub_01
midinous.add_events("key-press-mask")
canvas.add_events("button-press-mask")
canvas.add_events("button-release-mask")
canvas.add_events("pointer-motion-mask")
prop_mod.add_events("key-press-mask")
path_builder.sensitive = false
prop_mod_button.sensitive = false
stop.sensitive = false
tool_descrip.text = "Select"
t_sig.text = "4/4"
perf_label.markup = "<b>#{perf_label.text}</b>"
tempo_label.markup = "<b>#{tempo_label.text}</b>"
tool_label.markup = "<b>#{tool_label.text}</b>"
property_label.markup = "<b>#{property_label.text}</b>"
modify_label.markup = "<b>#{modify_label.text}</b>"
t_sig_label.markup = "<b>#{t_sig_label.text}</b>"
scale_label.markup = "<b>#{scale_label.text}</b>"
regen_status
file_chooser.filter = Gtk::FileFilter.new
file_chooser.filter.add_pattern("*.nous")
file_chooser.filter.name = "nous file filter"
end
|
#canvas ⇒ Object
156
157
158
|
# File 'lib/midinous/style/ui.rb', line 156
def canvas
@builder.get_object("canvas")
end
|
#canvas_h_adj ⇒ Object
167
168
169
|
# File 'lib/midinous/style/ui.rb', line 167
def canvas_h_adj
@builder.get_object("canvas_scroll_h")
end
|
162
163
164
|
# File 'lib/midinous/style/ui.rb', line 162
def canvas_scroll_window
@builder.get_object("canvas_scroll_window")
end
|
#canvas_v_adj ⇒ Object
170
171
172
|
# File 'lib/midinous/style/ui.rb', line 170
def canvas_v_adj
@builder.get_object("canvas_scroll_v")
end
|
#canvas_viewport ⇒ Object
159
160
161
|
# File 'lib/midinous/style/ui.rb', line 159
def canvas_viewport
@builder.get_object("canvas_viewport")
end
|
308
309
310
311
312
313
314
315
|
# File 'lib/midinous/style/ui.rb', line 308
def
@in_channel_items.each {|i| .remove(i)}
@in_channel_items = []
@in_device_items.each {|i| .remove(i)}
@in_device_items = []
@out_device_items.each {|o| .remove(o)}
@out_device_items = []
end
|
#confirm(type) ⇒ Object
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
|
# File 'lib/midinous/style/ui.rb', line 509
def confirm(type)
case type
when "new"
@current_window = "new_confirm"
confirmer_confirm.label = "Create New"
confirmer_label.markup = "<b> There are unsaved changes.</b> \n Do you wish to proceed? "
confirmer_cancel.visible = true
when "quit"
@current_window = "quit_confirm"
confirmer_confirm.label = "Quit"
confirmer_cancel.visible = true
confirmer_label.markup = "<b> There are unsaved changes.</b> \n Do you wish to proceed? "
when "path_warning"
@current_window = "path_warning"
confirmer_confirm.label = "OK"
confirmer_cancel.visible = false
confirmer_label.markup = "<b> WARNING:</b> Live composition detected. \n This may have affected round-robin point starting paths. "
end
confirmer.visible = true
end
|
#confirm_act(choice) ⇒ Object
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
|
# File 'lib/midinous/style/ui.rb', line 575
def confirm_act(choice)
if choice == "yes"
case @current_window
when "new_confirm"
CC.nouspoints = []
file_name.text = ""
CC.tempo = 120
CC.scale = "Chromatic"
CC.root_note = 60
CC.beats = 4
CC.beat_note = 4
CC.set_tempo(CC.tempo)
CC.set_scale(CC.scale,CC.root_note)
CC.canvas_grid_change(nil)
tempo_adj.value = CC.tempo
@scale_iters.each {|s| scale_combo.active_iter = s if s[0] == CC.scale}
root_adj.value = CC.root_note
@current_file = nil
midinous.title = "Midinous"
when "quit_confirm"
Gtk.main_quit
end
end
confirmer.visible = false
canvas.queue_draw
end
|
#confirmer ⇒ Object
90
91
92
|
# File 'lib/midinous/style/ui.rb', line 90
def confirmer
@builder.get_object("confirmer")
end
|
#confirmer_cancel ⇒ Object
220
221
222
|
# File 'lib/midinous/style/ui.rb', line 220
def confirmer_cancel
@builder.get_object("confirmer_cancel")
end
|
#confirmer_confirm ⇒ Object
217
218
219
|
# File 'lib/midinous/style/ui.rb', line 217
def confirmer_confirm
@builder.get_object("confirmer_confirm")
end
|
#confirmer_label ⇒ Object
265
266
267
|
# File 'lib/midinous/style/ui.rb', line 265
def confirmer_label
@builder.get_object("confirmer_label")
end
|
#edit_io ⇒ Object
139
140
141
|
# File 'lib/midinous/style/ui.rb', line 139
def edit_io
@builder.get_object("edit_io")
end
|
107
108
109
|
# File 'lib/midinous/style/ui.rb', line 107
def
@builder.get_object("edit_menu")
end
|
#file_cancel ⇒ Object
214
215
216
|
# File 'lib/midinous/style/ui.rb', line 214
def file_cancel
@builder.get_object("file_cancel")
end
|
#file_chooser ⇒ Object
87
88
89
|
# File 'lib/midinous/style/ui.rb', line 87
def file_chooser
@builder.get_object("file_chooser")
end
|
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
|
# File 'lib/midinous/style/ui.rb', line 529
def file_input_check(type)
case type
when "chooser"
unless UI::file_chooser.uri == nil
UI::file_name.text = UI::file_chooser.uri.split("/").last
else
UI::file_name.text = ""
end
when "name"
unless UI::file_name.text != "" ||
UI::file_chooser.uri != nil ||
UI::file_name.text.count(".") > 1
then
UI::file_operation.sensitive = false
else UI::file_operation.sensitive = true
end
end
end
|
#file_name ⇒ Object
242
243
244
|
# File 'lib/midinous/style/ui.rb', line 242
def file_name
@builder.get_object("file_name")
end
|
#file_new ⇒ Object
124
125
126
|
# File 'lib/midinous/style/ui.rb', line 124
def file_new
@builder.get_object("file_new")
end
|
#file_open ⇒ Object
127
128
129
|
# File 'lib/midinous/style/ui.rb', line 127
def file_open
@builder.get_object("file_open")
end
|
#file_oper(type) ⇒ Object
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
|
# File 'lib/midinous/style/ui.rb', line 547
def file_oper(type)
case type
when "open"
@current_window = "file_open"
file_chooser.title = "Open"
file_operation.label = "Open"
file_chooser.visible = true
file_name.editable = false
when "save"
@current_window = "file_save"
if @current_file == nil file_chooser.title = "Save As"
file_operation.label = "Save As"
file_name.editable = true
file_chooser.visible = true
else
save_operation end
when "saveas"
@current_window = "file_save"
file_name.text = @current_file.split("\\").last unless @current_file == nil
file_chooser.title = "Save As"
file_operation.label = "Save As"
file_name.editable = true
file_chooser.visible = true
end
end
|
#file_oper_act(choice) ⇒ Object
602
603
604
605
606
607
608
609
610
611
612
613
614
615
|
# File 'lib/midinous/style/ui.rb', line 602
def file_oper_act(choice)
if choice == "yes"
case @current_window
when "file_open"
load_operation
when "file_save"
save_operation
end
end
file_chooser.visible = false
canvas.queue_draw
end
|
#file_operation ⇒ Object
211
212
213
|
# File 'lib/midinous/style/ui.rb', line 211
def file_operation
@builder.get_object("file_operation")
end
|
#file_quit ⇒ Object
136
137
138
|
# File 'lib/midinous/style/ui.rb', line 136
def file_quit
@builder.get_object("file_quit")
end
|
#file_save ⇒ Object
130
131
132
|
# File 'lib/midinous/style/ui.rb', line 130
def file_save
@builder.get_object("file_save")
end
|
#file_save_as ⇒ Object
133
134
135
|
# File 'lib/midinous/style/ui.rb', line 133
def file_save_as
@builder.get_object("file_save_as")
end
|
#help_about ⇒ Object
142
143
144
|
# File 'lib/midinous/style/ui.rb', line 142
def help_about
@builder.get_object("help_about")
end
|
#help_hotkeys ⇒ Object
151
152
153
|
# File 'lib/midinous/style/ui.rb', line 151
def help_hotkeys
@builder.get_object("help_hotkeys")
end
|
119
120
121
|
# File 'lib/midinous/style/ui.rb', line 119
def
@builder.get_object("help_menu")
end
|
#help_notes ⇒ Object
145
146
147
|
# File 'lib/midinous/style/ui.rb', line 145
def help_notes
@builder.get_object("help_notes")
end
|
#help_scales ⇒ Object
148
149
150
|
# File 'lib/midinous/style/ui.rb', line 148
def help_scales
@builder.get_object("help_scales")
end
|
#hotkeys_window ⇒ Object
102
103
104
|
# File 'lib/midinous/style/ui.rb', line 102
def hotkeys_window
@builder.get_object("hotkeys_window")
end
|
116
117
118
|
# File 'lib/midinous/style/ui.rb', line 116
def
@builder.get_object("input_channel_menu")
end
|
110
111
112
|
# File 'lib/midinous/style/ui.rb', line 110
def
@builder.get_object("input_menu")
end
|
#load_operation ⇒ Object
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
|
# File 'lib/midinous/style/ui.rb', line 647
def load_operation
CC.canvas_stop
CC.nouspoints = []
@current_file = file_chooser.uri
operator = @current_file.sub("file:///","")
operator = operator.gsub("/","\\")
operator = operator.gsub("%20"," ")
load = IO.binread(operator)
load = load.gsub("\r","")
load = load.split("\n")
load[0..-2].each do |point_line|
point_line = point_line.split("<~>")
CC.nouspoints << NousPoint.new(eval(point_line[1]),point_line[0].to_i)
end
CC.nouspoints.each do |n|
load.each do |point_line|
point_line = point_line.split("<~>")
if point_line[0].to_i == n.save_id
if point_line[2].match(/^([+]|-)[0-9]{1,2}$/)
n.note = point_line[2]
n.use_rel = true
elsif (point_line[2].to_i >= 0 &&
point_line[2].to_i <= 127 &&
!(point_line[2].include?("+") || point_line[2].include?("-")))
then
n.note = point_line[2].to_i
end
n.velocity = point_line[3].to_i
n.channel = point_line[4].to_i
n.duration = point_line[5].to_i
n.set_default_color(hex_to_color(point_line[6]))
n.repeat = point_line[7].to_i
n.play_modes = eval(point_line[8])
n.traveler_start = eval(point_line[9])
n.use_rel = eval(point_line[10])
n.path_mode = point_line[11]
n.path_to_rels = eval(point_line[12])
n.path_from_rels = eval(point_line[13])
n.path_to_rels.each {|ptr| n.path_to << CC.nouspoints.find {|f| ptr == f.save_id}}
n.path_from_rels.each {|pfr| n.path_from << CC.nouspoints.find {|f| pfr == f.save_id}}
end
end
end
load_last = load.last.split("<~>")
CC.tempo = load_last[0].to_f
CC.scale = load_last[1]
CC.root_note = load_last[2].to_i
CC.beats = load_last[3].to_i
CC.beat_note = load_last[4].to_i
CC.set_tempo(CC.tempo)
CC.set_scale(CC.scale,CC.root_note)
CC.canvas_grid_change(nil)
tempo_adj.value = CC.tempo
@scale_iters.each {|s| scale_combo.active_iter = s if s[0] == CC.scale}
root_adj.value = CC.root_note
midinous.title = "Midinous - #{operator}"
end
|
#logic_controls ⇒ Object
225
226
227
|
# File 'lib/midinous/style/ui.rb', line 225
def logic_controls
@builder.get_object("logic_controls")
end
|
#main_tool_1 ⇒ Object
181
182
183
|
# File 'lib/midinous/style/ui.rb', line 181
def main_tool_1
@builder.get_object("main_tool_1")
end
|
#main_tool_2 ⇒ Object
184
185
186
|
# File 'lib/midinous/style/ui.rb', line 184
def main_tool_2
@builder.get_object("main_tool_2")
end
|
#main_tool_3 ⇒ Object
187
188
189
|
# File 'lib/midinous/style/ui.rb', line 187
def main_tool_3
@builder.get_object("main_tool_3")
end
|
#main_tool_4 ⇒ Object
190
191
192
|
# File 'lib/midinous/style/ui.rb', line 190
def main_tool_4
@builder.get_object("main_tool_4")
end
|
#midinous ⇒ Object
84
85
86
|
# File 'lib/midinous/style/ui.rb', line 84
def midinous
@builder.get_object("midinous")
end
|
#modify_label ⇒ Object
259
260
261
|
# File 'lib/midinous/style/ui.rb', line 259
def modify_label
@builder.get_object("modify_label")
end
|
#notes_window ⇒ Object
96
97
98
|
# File 'lib/midinous/style/ui.rb', line 96
def notes_window
@builder.get_object("notes_window")
end
|
113
114
115
|
# File 'lib/midinous/style/ui.rb', line 113
def
@builder.get_object("output_menu")
end
|
#path_builder ⇒ Object
193
194
195
|
# File 'lib/midinous/style/ui.rb', line 193
def path_builder
@builder.get_object("path_builder")
end
|
#perf_label ⇒ Object
247
248
249
|
# File 'lib/midinous/style/ui.rb', line 247
def perf_label
@builder.get_object("perf_label")
end
|
#play ⇒ Object
199
200
201
|
# File 'lib/midinous/style/ui.rb', line 199
def play
@builder.get_object("play")
end
|
#prop_list ⇒ Object
279
280
281
|
# File 'lib/midinous/style/ui.rb', line 279
def prop_list
@builder.get_object("prop_list")
end
|
#prop_list_col1 ⇒ Object
288
289
290
|
# File 'lib/midinous/style/ui.rb', line 288
def prop_list_col1
@builder.get_object("prop_list_col1")
end
|
#prop_list_col1_h ⇒ Object
282
283
284
|
# File 'lib/midinous/style/ui.rb', line 282
def prop_list_col1_h
@builder.get_object("prop_list_col1_h")
end
|
#prop_list_col2 ⇒ Object
291
292
293
|
# File 'lib/midinous/style/ui.rb', line 291
def prop_list_col2
@builder.get_object("prop_list_col2")
end
|
#prop_list_col2_h ⇒ Object
285
286
287
|
# File 'lib/midinous/style/ui.rb', line 285
def prop_list_col2_h
@builder.get_object("prop_list_col2_h")
end
|
#prop_list_model ⇒ Object
273
274
275
|
# File 'lib/midinous/style/ui.rb', line 273
def prop_list_model
@builder.get_object("prop_list_model")
end
|
#prop_list_selection ⇒ Object
294
295
296
|
# File 'lib/midinous/style/ui.rb', line 294
def prop_list_selection
@builder.get_object("prop_list_selection")
end
|
#prop_list_view ⇒ Object
276
277
278
|
# File 'lib/midinous/style/ui.rb', line 276
def prop_list_view
@builder.get_object("prop_list_view")
end
|
#prop_mod ⇒ Object
236
237
238
|
# File 'lib/midinous/style/ui.rb', line 236
def prop_mod
@builder.get_object("prop_mod")
end
|
196
197
198
|
# File 'lib/midinous/style/ui.rb', line 196
def prop_mod_button
@builder.get_object("prop_mod_button")
end
|
#property_label ⇒ Object
256
257
258
|
# File 'lib/midinous/style/ui.rb', line 256
def property_label
@builder.get_object("property_label")
end
|
#regen_status ⇒ Object
342
343
344
345
346
347
348
349
|
# File 'lib/midinous/style/ui.rb', line 342
def regen_status
unless Pm.in_list.length <= 1
status_area.text = "Using: Output[#{Pm.out_list[Pm.out_id].name}] "\
"Input[#{Pm.in_list[Pm.in_id].name} Channel: #{Pm.in_chan}]"
else
status_area.text = "Using: Output[#{Pm.out_list[Pm.out_id].name}]"
end
end
|
#root_adj ⇒ Object
176
177
178
|
# File 'lib/midinous/style/ui.rb', line 176
def root_adj
@builder.get_object("root_adj")
end
|
#root_select ⇒ Object
208
209
210
|
# File 'lib/midinous/style/ui.rb', line 208
def root_select
@builder.get_object("root_select")
end
|
#save_operation ⇒ Object
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
|
# File 'lib/midinous/style/ui.rb', line 617
def save_operation
unless file_name.text[-5..-1] == ".nous"
@current_file = "#{file_chooser.current_folder_uri}/#{file_name.text}.nous"
else @current_file = "#{file_chooser.current_folder_uri}/#{file_name.text}"
end
operator = @current_file.sub("file:///","")
operator = operator.gsub("/","\\")
IO.binwrite(operator, "")
save = File.open(operator, "a")
issued_id = 0
CC.nouspoints.each do |n|
n.save_id = issued_id
issued_id += 1
end
CC.nouspoints.each do |n|
n.write_props(save)
save.write("\n")
end
save.write("#{CC.tempo}<~>")
save.write("#{CC.scale}<~>")
save.write("#{CC.root_note}<~>")
save.write("#{CC.beats}<~>")
save.write("#{CC.beat_note}")
midinous.title = "Midinous - #{operator}"
save.close
end
|
#scale_combo ⇒ Object
Scale Selection Combo Box
299
300
301
|
# File 'lib/midinous/style/ui.rb', line 299
def scale_combo
@builder.get_object("scale_combo")
end
|
#scale_display ⇒ Object
305
306
307
|
# File 'lib/midinous/style/ui.rb', line 305
def scale_display
@builder.get_object("scale_display")
end
|
#scale_label ⇒ Object
268
269
270
|
# File 'lib/midinous/style/ui.rb', line 268
def scale_label
@builder.get_object("scale_label")
end
|
#scale_tree_model ⇒ Object
302
303
304
|
# File 'lib/midinous/style/ui.rb', line 302
def scale_tree_model
@builder.get_object("scale_tree_model")
end
|
#scales_window ⇒ Object
99
100
101
|
# File 'lib/midinous/style/ui.rb', line 99
def scales_window
@builder.get_object("scales_window")
end
|
#set_device(id, type) ⇒ Object
332
333
334
335
336
337
338
339
340
|
# File 'lib/midinous/style/ui.rb', line 332
def set_device(id,type)
case type
when 'i'
Pm.sel_in(id)
when 'o'
Pm.sel_out(id)
end
regen_status
end
|
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
|
# File 'lib/midinous/style/ui.rb', line 316
def
unless Pm.in_list.length <= 1
16.times.with_index {|i| @in_channel_items << Gtk::ImageMenuItem.new(label: (i+1).to_s)}
@in_channel_items.each {|i| .append(i)}
Pm.in_list.each {|i| @in_device_items << Gtk::ImageMenuItem.new(label: i.name)}
@in_device_items.each {|i| .append(i)}
end
Pm.out_list.each {|o| @out_device_items << Gtk::ImageMenuItem.new(label: o.name)}
@out_device_items.each {|o| .append(o)}
.show_all
.show_all
.show_all
end
|
#status_area ⇒ Object
233
234
235
|
# File 'lib/midinous/style/ui.rb', line 233
def status_area
@builder.get_object("status_area")
end
|
#stop ⇒ Object
202
203
204
|
# File 'lib/midinous/style/ui.rb', line 202
def stop
@builder.get_object("stop")
end
|
#t_sig ⇒ Object
239
240
241
|
# File 'lib/midinous/style/ui.rb', line 239
def t_sig
@builder.get_object("t_sig")
end
|
#t_sig_label ⇒ Object
262
263
264
|
# File 'lib/midinous/style/ui.rb', line 262
def t_sig_label
@builder.get_object("t_sig_label")
end
|
#tempo ⇒ Object
205
206
207
|
# File 'lib/midinous/style/ui.rb', line 205
def tempo
@builder.get_object("tempo")
end
|
#tempo_adj ⇒ Object
173
174
175
|
# File 'lib/midinous/style/ui.rb', line 173
def tempo_adj
@builder.get_object("tempo_adj")
end
|
#tempo_label ⇒ Object
253
254
255
|
# File 'lib/midinous/style/ui.rb', line 253
def tempo_label
@builder.get_object("tempo_label")
end
|
230
231
232
|
# File 'lib/midinous/style/ui.rb', line 230
def tool_descrip
@builder.get_object("tool_descrip")
end
|
250
251
252
|
# File 'lib/midinous/style/ui.rb', line 250
def tool_label
@builder.get_object("tool_label")
end
|