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.
69
70
71
72
73
74
75
76
77
|
# File 'lib/midinous/style/ui.rb', line 69
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
67
68
69
|
# File 'lib/midinous/style/ui.rb', line 67
def canvas_commands
@canvas_commands
end
|
#in_channel_items ⇒ Object
Construct a Gtk::Builder instance and load our UI description
67
68
69
|
# File 'lib/midinous/style/ui.rb', line 67
def in_channel_items
@in_channel_items
end
|
#in_device_items ⇒ Object
Construct a Gtk::Builder instance and load our UI description
67
68
69
|
# File 'lib/midinous/style/ui.rb', line 67
def in_device_items
@in_device_items
end
|
#menu_commands ⇒ Object
Construct a Gtk::Builder instance and load our UI description
67
68
69
|
# File 'lib/midinous/style/ui.rb', line 67
def menu_commands
@menu_commands
end
|
#out_device_items ⇒ Object
Construct a Gtk::Builder instance and load our UI description
67
68
69
|
# File 'lib/midinous/style/ui.rb', line 67
def out_device_items
@out_device_items
end
|
Instance Method Details
#about_window ⇒ Object
94
95
96
|
# File 'lib/midinous/style/ui.rb', line 94
def about_window
@builder.get_object("about_window")
end
|
#build_ui ⇒ Object
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
509
|
# File 'lib/midinous/style/ui.rb', line 78
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::.new(label: (i+1).to_s)}
@in_channel_items.each {|i| .append(i)}
Pm.in_list.each {|i| @in_device_items << Gtk::.new(label: i.name)}
@in_device_items.each {|i| .append(i)}
end
Pm.out_list.each {|o| @out_device_items << Gtk::.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
157
158
159
|
# File 'lib/midinous/style/ui.rb', line 157
def canvas
@builder.get_object("canvas")
end
|
#canvas_h_adj ⇒ Object
168
169
170
|
# File 'lib/midinous/style/ui.rb', line 168
def canvas_h_adj
@builder.get_object("canvas_scroll_h")
end
|
163
164
165
|
# File 'lib/midinous/style/ui.rb', line 163
def canvas_scroll_window
@builder.get_object("canvas_scroll_window")
end
|
#canvas_v_adj ⇒ Object
171
172
173
|
# File 'lib/midinous/style/ui.rb', line 171
def canvas_v_adj
@builder.get_object("canvas_scroll_v")
end
|
#canvas_viewport ⇒ Object
160
161
162
|
# File 'lib/midinous/style/ui.rb', line 160
def canvas_viewport
@builder.get_object("canvas_viewport")
end
|
309
310
311
312
313
314
315
316
|
# File 'lib/midinous/style/ui.rb', line 309
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
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
|
# File 'lib/midinous/style/ui.rb', line 510
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
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
602
603
604
605
606
607
|
# File 'lib/midinous/style/ui.rb', line 576
def confirm_act(choice)
if choice == "yes"
case @current_window
when "new_confirm"
CC.nouspoints.each do |n|
n.traveler_start = false
n.path_to = []
n.path_from = []
end
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
91
92
93
|
# File 'lib/midinous/style/ui.rb', line 91
def confirmer
@builder.get_object("confirmer")
end
|
#confirmer_cancel ⇒ Object
221
222
223
|
# File 'lib/midinous/style/ui.rb', line 221
def confirmer_cancel
@builder.get_object("confirmer_cancel")
end
|
#confirmer_confirm ⇒ Object
218
219
220
|
# File 'lib/midinous/style/ui.rb', line 218
def confirmer_confirm
@builder.get_object("confirmer_confirm")
end
|
#confirmer_label ⇒ Object
266
267
268
|
# File 'lib/midinous/style/ui.rb', line 266
def confirmer_label
@builder.get_object("confirmer_label")
end
|
#edit_io ⇒ Object
140
141
142
|
# File 'lib/midinous/style/ui.rb', line 140
def edit_io
@builder.get_object("edit_io")
end
|
108
109
110
|
# File 'lib/midinous/style/ui.rb', line 108
def
@builder.get_object("edit_menu")
end
|
#file_cancel ⇒ Object
215
216
217
|
# File 'lib/midinous/style/ui.rb', line 215
def file_cancel
@builder.get_object("file_cancel")
end
|
#file_chooser ⇒ Object
88
89
90
|
# File 'lib/midinous/style/ui.rb', line 88
def file_chooser
@builder.get_object("file_chooser")
end
|
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
|
# File 'lib/midinous/style/ui.rb', line 530
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
243
244
245
|
# File 'lib/midinous/style/ui.rb', line 243
def file_name
@builder.get_object("file_name")
end
|
#file_new ⇒ Object
125
126
127
|
# File 'lib/midinous/style/ui.rb', line 125
def file_new
@builder.get_object("file_new")
end
|
#file_open ⇒ Object
128
129
130
|
# File 'lib/midinous/style/ui.rb', line 128
def file_open
@builder.get_object("file_open")
end
|
#file_oper(type) ⇒ Object
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
575
|
# File 'lib/midinous/style/ui.rb', line 548
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
608
609
610
611
612
613
614
615
616
617
618
619
620
621
|
# File 'lib/midinous/style/ui.rb', line 608
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
212
213
214
|
# File 'lib/midinous/style/ui.rb', line 212
def file_operation
@builder.get_object("file_operation")
end
|
#file_quit ⇒ Object
137
138
139
|
# File 'lib/midinous/style/ui.rb', line 137
def file_quit
@builder.get_object("file_quit")
end
|
#file_save ⇒ Object
131
132
133
|
# File 'lib/midinous/style/ui.rb', line 131
def file_save
@builder.get_object("file_save")
end
|
#file_save_as ⇒ Object
134
135
136
|
# File 'lib/midinous/style/ui.rb', line 134
def file_save_as
@builder.get_object("file_save_as")
end
|
#help_about ⇒ Object
143
144
145
|
# File 'lib/midinous/style/ui.rb', line 143
def help_about
@builder.get_object("help_about")
end
|
#help_hotkeys ⇒ Object
152
153
154
|
# File 'lib/midinous/style/ui.rb', line 152
def help_hotkeys
@builder.get_object("help_hotkeys")
end
|
120
121
122
|
# File 'lib/midinous/style/ui.rb', line 120
def
@builder.get_object("help_menu")
end
|
#help_notes ⇒ Object
146
147
148
|
# File 'lib/midinous/style/ui.rb', line 146
def help_notes
@builder.get_object("help_notes")
end
|
#help_scales ⇒ Object
149
150
151
|
# File 'lib/midinous/style/ui.rb', line 149
def help_scales
@builder.get_object("help_scales")
end
|
#hotkeys_window ⇒ Object
103
104
105
|
# File 'lib/midinous/style/ui.rb', line 103
def hotkeys_window
@builder.get_object("hotkeys_window")
end
|
117
118
119
|
# File 'lib/midinous/style/ui.rb', line 117
def
@builder.get_object("input_channel_menu")
end
|
111
112
113
|
# File 'lib/midinous/style/ui.rb', line 111
def
@builder.get_object("input_menu")
end
|
#load_operation ⇒ Object
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
707
708
709
710
711
712
713
714
|
# File 'lib/midinous/style/ui.rb', line 654
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.mute = eval(point_line[12])
n.path_to_rels = eval(point_line[13])
n.path_from_rels = eval(point_line[14])
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
226
227
228
|
# File 'lib/midinous/style/ui.rb', line 226
def logic_controls
@builder.get_object("logic_controls")
end
|
#main_tool_1 ⇒ Object
182
183
184
|
# File 'lib/midinous/style/ui.rb', line 182
def main_tool_1
@builder.get_object("main_tool_1")
end
|
#main_tool_2 ⇒ Object
185
186
187
|
# File 'lib/midinous/style/ui.rb', line 185
def main_tool_2
@builder.get_object("main_tool_2")
end
|
#main_tool_3 ⇒ Object
188
189
190
|
# File 'lib/midinous/style/ui.rb', line 188
def main_tool_3
@builder.get_object("main_tool_3")
end
|
#main_tool_4 ⇒ Object
191
192
193
|
# File 'lib/midinous/style/ui.rb', line 191
def main_tool_4
@builder.get_object("main_tool_4")
end
|
#midinous ⇒ Object
85
86
87
|
# File 'lib/midinous/style/ui.rb', line 85
def midinous
@builder.get_object("midinous")
end
|
#modify_label ⇒ Object
260
261
262
|
# File 'lib/midinous/style/ui.rb', line 260
def modify_label
@builder.get_object("modify_label")
end
|
#notes_window ⇒ Object
97
98
99
|
# File 'lib/midinous/style/ui.rb', line 97
def notes_window
@builder.get_object("notes_window")
end
|
114
115
116
|
# File 'lib/midinous/style/ui.rb', line 114
def
@builder.get_object("output_menu")
end
|
#path_builder ⇒ Object
194
195
196
|
# File 'lib/midinous/style/ui.rb', line 194
def path_builder
@builder.get_object("path_builder")
end
|
#perf_label ⇒ Object
248
249
250
|
# File 'lib/midinous/style/ui.rb', line 248
def perf_label
@builder.get_object("perf_label")
end
|
#play ⇒ Object
200
201
202
|
# File 'lib/midinous/style/ui.rb', line 200
def play
@builder.get_object("play")
end
|
#prop_list ⇒ Object
280
281
282
|
# File 'lib/midinous/style/ui.rb', line 280
def prop_list
@builder.get_object("prop_list")
end
|
#prop_list_col1 ⇒ Object
289
290
291
|
# File 'lib/midinous/style/ui.rb', line 289
def prop_list_col1
@builder.get_object("prop_list_col1")
end
|
#prop_list_col1_h ⇒ Object
283
284
285
|
# File 'lib/midinous/style/ui.rb', line 283
def prop_list_col1_h
@builder.get_object("prop_list_col1_h")
end
|
#prop_list_col2 ⇒ Object
292
293
294
|
# File 'lib/midinous/style/ui.rb', line 292
def prop_list_col2
@builder.get_object("prop_list_col2")
end
|
#prop_list_col2_h ⇒ Object
286
287
288
|
# File 'lib/midinous/style/ui.rb', line 286
def prop_list_col2_h
@builder.get_object("prop_list_col2_h")
end
|
#prop_list_model ⇒ Object
274
275
276
|
# File 'lib/midinous/style/ui.rb', line 274
def prop_list_model
@builder.get_object("prop_list_model")
end
|
#prop_list_selection ⇒ Object
295
296
297
|
# File 'lib/midinous/style/ui.rb', line 295
def prop_list_selection
@builder.get_object("prop_list_selection")
end
|
#prop_list_view ⇒ Object
277
278
279
|
# File 'lib/midinous/style/ui.rb', line 277
def prop_list_view
@builder.get_object("prop_list_view")
end
|
#prop_mod ⇒ Object
237
238
239
|
# File 'lib/midinous/style/ui.rb', line 237
def prop_mod
@builder.get_object("prop_mod")
end
|
197
198
199
|
# File 'lib/midinous/style/ui.rb', line 197
def prop_mod_button
@builder.get_object("prop_mod_button")
end
|
#property_label ⇒ Object
257
258
259
|
# File 'lib/midinous/style/ui.rb', line 257
def property_label
@builder.get_object("property_label")
end
|
#regen_status ⇒ Object
343
344
345
346
347
348
349
350
|
# File 'lib/midinous/style/ui.rb', line 343
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
177
178
179
|
# File 'lib/midinous/style/ui.rb', line 177
def root_adj
@builder.get_object("root_adj")
end
|
#root_select ⇒ Object
209
210
211
|
# File 'lib/midinous/style/ui.rb', line 209
def root_select
@builder.get_object("root_select")
end
|
#save_operation ⇒ Object
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
|
# File 'lib/midinous/style/ui.rb', line 623
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("/","\\")
operator = operator.gsub("%20"," ")
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
300
301
302
|
# File 'lib/midinous/style/ui.rb', line 300
def scale_combo
@builder.get_object("scale_combo")
end
|
#scale_display ⇒ Object
306
307
308
|
# File 'lib/midinous/style/ui.rb', line 306
def scale_display
@builder.get_object("scale_display")
end
|
#scale_label ⇒ Object
269
270
271
|
# File 'lib/midinous/style/ui.rb', line 269
def scale_label
@builder.get_object("scale_label")
end
|
#scale_tree_model ⇒ Object
303
304
305
|
# File 'lib/midinous/style/ui.rb', line 303
def scale_tree_model
@builder.get_object("scale_tree_model")
end
|
#scales_window ⇒ Object
100
101
102
|
# File 'lib/midinous/style/ui.rb', line 100
def scales_window
@builder.get_object("scales_window")
end
|
#set_device(id, type) ⇒ Object
333
334
335
336
337
338
339
340
341
|
# File 'lib/midinous/style/ui.rb', line 333
def set_device(id,type)
case type
when 'i'
Pm.sel_in(id)
when 'o'
Pm.sel_out(id)
end
regen_status
end
|
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
|
# File 'lib/midinous/style/ui.rb', line 317
def
unless Pm.in_list.length <= 1
16.times.with_index {|i| @in_channel_items << Gtk::.new(label: (i+1).to_s)}
@in_channel_items.each {|i| .append(i)}
Pm.in_list.each {|i| @in_device_items << Gtk::.new(label: i.name)}
@in_device_items.each {|i| .append(i)}
end
Pm.out_list.each {|o| @out_device_items << Gtk::.new(label: o.name)}
@out_device_items.each {|o| .append(o)}
.show_all
.show_all
.show_all
end
|
#status_area ⇒ Object
234
235
236
|
# File 'lib/midinous/style/ui.rb', line 234
def status_area
@builder.get_object("status_area")
end
|
#stop ⇒ Object
203
204
205
|
# File 'lib/midinous/style/ui.rb', line 203
def stop
@builder.get_object("stop")
end
|
#t_sig ⇒ Object
240
241
242
|
# File 'lib/midinous/style/ui.rb', line 240
def t_sig
@builder.get_object("t_sig")
end
|
#t_sig_label ⇒ Object
263
264
265
|
# File 'lib/midinous/style/ui.rb', line 263
def t_sig_label
@builder.get_object("t_sig_label")
end
|
#tempo ⇒ Object
206
207
208
|
# File 'lib/midinous/style/ui.rb', line 206
def tempo
@builder.get_object("tempo")
end
|
#tempo_adj ⇒ Object
174
175
176
|
# File 'lib/midinous/style/ui.rb', line 174
def tempo_adj
@builder.get_object("tempo_adj")
end
|
#tempo_label ⇒ Object
254
255
256
|
# File 'lib/midinous/style/ui.rb', line 254
def tempo_label
@builder.get_object("tempo_label")
end
|
231
232
233
|
# File 'lib/midinous/style/ui.rb', line 231
def tool_descrip
@builder.get_object("tool_descrip")
end
|
251
252
253
|
# File 'lib/midinous/style/ui.rb', line 251
def tool_label
@builder.get_object("tool_label")
end
|