void vsx_widget_base_edit::vsx_command_process_b(vsx_command_s *t) { updates++; if (t->cmd == "action") { // TODO: take into account hidden lines backwards_message("editor_action "+i2s(id)+" "+lines[scroll_y+s2i(t->parts[1])]); } else if (t->cmd == "font_size") { font_size = s2f(t->parts[1]); } else if (t->cmd == "clear") { k_focus = this; set_string(""); } }
void vsx_widget_seq_pool_manager::command_process_back_queue(vsx_command_s *t) { // MESSAGES FROM THE ENGINE if (t->cmd == "seq_pool") { if (t->parts[1] == "del") { } if (t->parts[1] == "dump_names") { if (t->parts.size() > 2) { ((vsx_widget_pool_tree*)edit)->set_string(vsx_string_helper::str_replace<char>(";", "\n", t->parts[2])); } else { ((vsx_widget_pool_tree*)edit)->set_string("[none defined]"); } } else if (t->parts[1] == "clear_sequencer") { if (sequencer) { ((vsx_widget_sequence_editor*)sequencer)->clear_sequencer(); ((vsx_widget_sequence_editor*)sequencer)->load_sequence_list(); } } else if ( t->parts[1] == "pseq_p_ok" || t->parts[1] == "pseq_r_ok" || t->parts[1] == "pseq_l_dump_ok" || t->parts[1] == "seq_list_ok" || t->parts[1] == "group_list_ok" || t->parts[1] == "time_upd" ) { if (sequencer) { vsx_string<>command; for (unsigned long i = 1; i < t->parts.size(); i++) { if (i != 1) command += " "; command += t->parts[i]; } command_q_b.add_raw(command); sequencer->vsx_command_queue_b(this,true); } } else if (t->parts[1] == "toggle_edit") { if (t->parts[2] == "1") { //sequencer init sequencer = (vsx_widget*)add(new vsx_widget_sequence_editor,"Animation Sequencer"); // don't display master channel button ((vsx_widget_sequence_editor*)sequencer)->disable_master_channel = true; sequencer->constrained_y = sequencer->constrained_x = false; sequencer->coord_related_parent = false; sequencer->set_pos(vsx_vector3<>(0.0f,-0.6f)); sequencer->init(); ((vsx_widget_sequence_editor*)sequencer)->set_server( server ); } else { if (sequencer) { sequencer->_delete(); sequencer = 0; } } } else command_q_b.add(t); } else if (t->cmd == "time_set_speed") { command_q_b.add(t); parent->vsx_command_queue_b(this); } // MESSAGES FOR THE ENGINE if ( t->cmd == "stop" || t->cmd == "rewind" || t->cmd == "play" || t->cmd == "time_set_loop_point" || t->cmd == "time_set" || t->cmd == "pseq_p" || t->cmd == "pseq_r" || t->cmd == "pseq_l_dump" || t->cmd == "seq_list" || t->cmd == "group_list" || t->cmd == "group_del" || t->cmd == "propagate_time" || t->cmd == "pseq_inject_get_keyframe_at_time" ) { vsx_string<>command = "seq_pool"; for (unsigned long i = 0; i < t->parts.size(); i++) { command += " "; command += t->parts[i]; } command_q_b.add_raw(command); parent->vsx_command_queue_b(this); } else // GUI COMMANDS if (t->cmd == "cancel") { command_q_b.add(name+"_cancel","cancel"); parent->vsx_command_queue_b(this); visible = 0; return; } else if (t->cmd == "add") { ((dialog_query_string*)name_dialog)->show(); return; } else if (t->cmd == "dialog_add") { command_q_b.add_raw("seq_pool add " + t->parts[1]); parent->vsx_command_queue_b(this); } else if (t->cmd == "dialog_clone") { command_q_b.add_raw("seq_pool clone " + ((vsx_widget_pool_tree*)edit)->get_selected_item()+ " " + t->parts[1]); parent->vsx_command_queue_b(this); } else if (t->cmd == "dialog_import") { command_q_b.add_raw("seq_pool import " + t->parts[1]); parent->vsx_command_queue_b(this); } else if (t->cmd == "dialog_export") { command_q_b.add_raw("seq_pool export " + t->parts[1]); parent->vsx_command_queue_b(this); } else if (t->cmd == "edit") { backwards_message("seq_pool toggle_edit"); } else if (t->cmd == "clone") { ((dialog_query_string*)clone_name_dialog)->show(); return; } else if (t->cmd == "gui_import") { ((dialog_query_string*)import_name_dialog)->show(); return; } else if (t->cmd == "gui_export") { ((dialog_query_string*)export_name_dialog)->show(); return; } else if (t->cmd == "clear") { if (sequencer) { sequencer->_delete(); sequencer = 0; } ((vsx_widget_pool_tree*)edit)->set_string("[none defined]"); } else if (t->cmd == "del") { vsx_string<>del_name = ((vsx_widget_pool_tree*)edit)->get_selected_item(); if (del_name != "") { backwards_message("seq_pool del "+del_name); } return; } else if (t->cmd == "close") { visible = 0; } }
void vsx_widget_seq_pool_manager::init() { backwards_message("seq_pool dump_names"); }
bool vsx_widget_timeline::event_key_down(signed long key, bool alt, bool ctrl, bool shift) { float dt = (owner->tend-owner->tstart)*0.5; switch(key) { case 'a': { if (ctrl) backwards_message("play"); else backwards_message("stop"); } } if (key == 't') show_wave_data = !show_wave_data; if (!ctrl) return true; switch(key) { case 'f': { owner->tstart += dt*0.03; owner->tend += dt*0.03; return false; } break; case 's': { owner->tstart -= dt*0.03; owner->tend -= dt*0.03; return false; } break; case 'w': { if (owner->curtime < owner->tstart) { owner->tstart = owner->curtime; owner->tend = owner->curtime + dt*2; } else if (owner->curtime > owner->tend) { owner->tstart = owner->curtime-dt*2; owner->tend = owner->curtime; } owner->tstart -= (owner->curtime-owner->tstart)/(dt)*dt*0.03; owner->tend += (owner->tend-owner->curtime)/(dt)*dt*0.03; return false; } break; case 'r': { if (owner->curtime < owner->tstart || owner->curtime > owner->tend) { //ddt = (owner->tend - owner->tstart)*0.5; owner->tstart = owner->curtime - dt; owner->tend = owner->curtime + dt; } //float ndt = dt*1.1; //float _tstart = owner->tstart+dt-dt*1.1; owner->tstart += (owner->curtime-owner->tstart)/(dt)*dt*0.03; owner->tend -= (owner->tend-owner->curtime)/(dt)*dt*0.03; //float _tend = owner->tend-dt+dt*1.1; //owner->tstart = owner->tstart+dt-dt*1.1; //owner->tend = owner->tend-dt+dt*1.1; //if (_tend - _tstart < 40) { //owner->tstart = _tstart; //owner->tend = _tend; // float dt = (owner->tend-owner->tstart)*0.5; /*float _tstart = owner->tstart+dt-dt*0.9; float _tend = owner->tend-dt+dt*0.9; if (owner->curtime > _tstart) { owner->tstart = _tstart; owner->tend = _tend; } */ return false; } break; } return true; }
void vsx_widget_sequence_editor::command_process_back_queue(vsx_command_s *t) { // internal operations if (t->cmd == "seq_pool") { if (t->parts[1] == "del") { remove_master_channel_items_with_name(t->parts[2]); } } else if (t->cmd == "menu_close") { command_q_b.add_raw("delete_sequencer"); parent->vsx_command_queue_b(this); } else if (t->cmd == "but_play") { command_q_b.add_raw("play"); update_time_from_engine = true; parent->vsx_command_queue_b(this); } else if (t->cmd == "button_add_master") { ((dialog_query_string*)name_dialog)->show(); return; } else if (t->cmd == "dialog_add") { command_q_b.add_raw("mseq_channel add " + t->parts[1]); parent->vsx_command_queue_b(this); } if (t->cmd == "but_set_loop_point") { ((dialog_query_string*)loop_point_dialog)->show(); return; } if (t->cmd == "dialog_set_loop_point") { command_q_b.add_raw("time_set_loop_point " + t->parts[1]); parent->vsx_command_queue_b(this); } else if (t->cmd == "but_set_speed") { ((dialog_query_string*)speed_dialog)->show(); return; } if (t->cmd == "dialog_set_speed") { command_q_b.add_raw("time_set_speed " + t->parts[1]); parent->vsx_command_queue_b(this); } if (t->cmd == "but_open_at_time") { channels_open_at_time(); return; } if (t->cmd == "but_copy") { action_copy(); return; } if (t->cmd == "but_paste") { action_paste(); return; } if (t->cmd == "but_show_sequence_list") { sequence_list->show(); sequence_group_list->hide(); } if (t->cmd == "but_show_sequence_group_list") { sequence_list->hide(); sequence_group_list->show(); } if (t->cmd == "editor_action") { if (t->parts.size() == 3) { vsx_string<>deli = ":"; vsx_nw_vector<vsx_string<> > parts; vsx_string_helper::explode(t->parts[2],deli, parts); if (parts[1] == "[master]") { backwards_message("mseq_channel remove " + parts[0] ); } else { backwards_message("pseq_p remove " + parts[0] + " " + parts[1]); } } } else if (t->cmd == "remove_chan") { t->parse(); bool run = true; channels_map.erase(t->parts[1]+":"+t->parts[2]); std::vector<vsx_widget*>::iterator it = channels.begin(); while (run) { if (((vsx_widget_sequence_channel*)(*it))->channel_name == t->parts[1] && ((vsx_widget_sequence_channel*)(*it))->param_name == t->parts[2]) { run = false; (*it)->_delete(); channels.erase(it); interpolate_size(); } else ++it; } } else if (t->cmd == "clear") { clear_sequencer(); } else if (t->cmd == "seq_list_ok") { if (t->parts.size() > 1) { vsx_string<>deli = "&"; vsx_nw_vector< vsx_string<> > parts; vsx_string_helper::explode(t->parts[1], deli, parts); std::map<vsx_string<>,vsx_string<> > sort_map; foreach(parts, i) sort_map[parts[i]] = parts[i]; vsx_nw_vector< vsx_string<> > sorted_names; for (std::map<vsx_string<>,vsx_string<> >::iterator it = sort_map.begin(); it != sort_map.end(); it++) sorted_names.push_back((*it).second); deli = "\n"; ((vsx_widget_sequence_tree*)sequence_list)->set_string(vsx_string_helper::implode(sorted_names,deli)); } else ((vsx_widget_sequence_tree*)sequence_list)->set_string("[none defined]"); } else if (t->cmd == "group_list_ok") { ((vsx_widget_sequence_group_tree*)sequence_group_list)->clear_groups(); vsx_string<> data = t->parts[1]; vsx_nw_vector< vsx_string<> > group_list; vsx_string_helper::explode_single(data, '|', group_list); foreach(group_list, i) { vsx_nw_vector< vsx_string<> > group_name_params; vsx_string_helper::explode_single(group_list[i], '+', group_name_params); groups[group_name_params[0]] = group_name_params[1]; ((vsx_widget_sequence_group_tree*)sequence_group_list)->add_group(group_name_params[0]); }