예제 #1
0
FindInFilesDialog::FindInFilesDialog() {

	set_custom_minimum_size(Size2(400, 190));
	set_resizable(true);
	set_title(TTR("Find in files"));

	VBoxContainer *vbc = memnew(VBoxContainer);
	vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 8 * EDSCALE);
	vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 8 * EDSCALE);
	vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -8 * EDSCALE);
	vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -8 * EDSCALE);
	add_child(vbc);

	GridContainer *gc = memnew(GridContainer);
	gc->set_columns(2);
	vbc->add_child(gc);

	Label *find_label = memnew(Label);
	find_label->set_text(TTR("Find: "));
	gc->add_child(find_label);

	_search_text_line_edit = memnew(LineEdit);
	_search_text_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
	_search_text_line_edit->connect("text_changed", this, "_on_search_text_modified");
	_search_text_line_edit->connect("text_entered", this, "_on_search_text_entered");
	gc->add_child(_search_text_line_edit);

	{
		Control *placeholder = memnew(Control);
		gc->add_child(placeholder);
	}

	{
		HBoxContainer *hbc = memnew(HBoxContainer);

		_whole_words_checkbox = memnew(CheckBox);
		_whole_words_checkbox->set_text(TTR("Whole words"));
		_whole_words_checkbox->set_pressed(true);
		hbc->add_child(_whole_words_checkbox);

		_match_case_checkbox = memnew(CheckBox);
		_match_case_checkbox->set_text(TTR("Match case"));
		_match_case_checkbox->set_pressed(true);
		hbc->add_child(_match_case_checkbox);

		gc->add_child(hbc);
	}

	Label *folder_label = memnew(Label);
	folder_label->set_text(TTR("Folder: "));
	gc->add_child(folder_label);

	{
		HBoxContainer *hbc = memnew(HBoxContainer);

		Label *prefix_label = memnew(Label);
		prefix_label->set_text(ROOT_PREFIX);
		hbc->add_child(prefix_label);

		_folder_line_edit = memnew(LineEdit);
		_folder_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
		hbc->add_child(_folder_line_edit);

		Button *folder_button = memnew(Button);
		folder_button->set_text("...");
		folder_button->connect("pressed", this, "_on_folder_button_pressed");
		hbc->add_child(folder_button);

		_folder_dialog = memnew(FileDialog);
		_folder_dialog->set_mode(FileDialog::MODE_OPEN_DIR);
		_folder_dialog->connect("dir_selected", this, "_on_folder_selected");
		add_child(_folder_dialog);

		gc->add_child(hbc);
	}

	Label *filter_label = memnew(Label);
	filter_label->set_text(TTR("Filter: "));
	gc->add_child(filter_label);

	{
		HBoxContainer *hbc = memnew(HBoxContainer);

		Vector<String> exts;
		exts.push_back("gd");
		exts.push_back("cs");

		for (int i = 0; i < exts.size(); ++i) {
			CheckBox *cb = memnew(CheckBox);
			cb->set_text(exts[i]);
			cb->set_pressed(true);
			hbc->add_child(cb);
			_filters.push_back(cb);
		}

		gc->add_child(hbc);
	}

	{
		Control *placeholder = memnew(Control);
		placeholder->set_custom_minimum_size(Size2(0, EDSCALE * 16));
		vbc->add_child(placeholder);
	}

	{
		HBoxContainer *hbc = memnew(HBoxContainer);
		hbc->set_alignment(HBoxContainer::ALIGN_CENTER);

		_find_button = memnew(Button);
		_find_button->set_text(TTR("Find..."));
		_find_button->connect("pressed", this, "_on_find_button_pressed");
		_find_button->set_disabled(true);
		hbc->add_child(_find_button);

		{
			Control *placeholder = memnew(Control);
			placeholder->set_custom_minimum_size(Size2(EDSCALE * 16, 0));
			hbc->add_child(placeholder);
		}

		_replace_button = memnew(Button);
		_replace_button->set_text(TTR("Replace..."));
		_replace_button->connect("pressed", this, "_on_replace_button_pressed");
		_replace_button->set_disabled(true);
		hbc->add_child(_replace_button);

		{
			Control *placeholder = memnew(Control);
			placeholder->set_custom_minimum_size(Size2(EDSCALE * 16, 0));
			hbc->add_child(placeholder);
		}

		Button *cancel_button = memnew(Button);
		cancel_button->set_text(TTR("Cancel"));
		cancel_button->connect("pressed", this, "hide");
		hbc->add_child(cancel_button);

		vbc->add_child(hbc);
	}
}
InstrumentScreen::InstrumentScreen(Tracker *p_tracker,bool p_mini) {
	
	mini_tabbox = p_mini?add(new TabBox,1):0;

	tracker=p_tracker;
	
	MarginGroup *mg=p_mini?mini_tabbox->add("List",new MarginGroup("Inst. List")):add(new MarginGroup("Instrument List"),3);
	
	mg->get_label_hb()->add( new Widget,1);
	edit = mg->get_label_hb()->add( new MenuBox("File.."));
	edit->add_item( "Clear" );
	edit->add_item( "Clear (With Samples)" );
	edit->add_separator();
	edit->add_item( "Load" );
	edit->add_item( "Save" );
	edit->add_separator();
	edit->add_item( "Copy" );
	edit->add_item( "Cut" );
	edit->add_item( "Paste" );
	edit->add_separator();
	edit->add_item( "Remap (separate samples)" );
	edit->add_item( "Remap All" );
	edit->item_selected_signal.connect( this, &InstrumentScreen::instrument_file_action_callback );
	
	HBoxContainer *slit_hb=mg->add(new HBoxContainer,1);
	
	instrument_list=slit_hb->add( new List, 1 );
	slit_hb->add( new VScrollBar, 0 )->set_range( instrument_list->get_range() );
	
	for (int i=0;i<Song::MAX_INSTRUMENTS;i++)
		instrument_list->add_string( "" );
	
	instrument_list->set_number_elements( 1 );
	instrument_list->set_number_min_integers( 2 );
	instrument_list->set_editable( true );
	instrument_list->set_max_string_length( 25 );
	instrument_list->set_incremental_search(false);	
	/* Instrument Global Tab */
	
	mg=p_mini?mini_tabbox->add("Edit",new MarginGroup("")):add(new MarginGroup("Parameters:"),5);
	
	
	sections=mg->add(new TabBox,1);
		
	HBoxContainer *mi_hb=sections->add( "General", new HBoxContainer );
	
	MarginGroup *mi_mg_table=mi_hb->add( new MarginGroup("Sample Table"),0 );
	
	HBoxContainer *st_hb=mi_mg_table->add( new HBoxContainer,1);
	sample_table=st_hb->add( new SampleInstrumentTable(tracker->editor),1);
	sample_table->set_range( st_hb->add( new VScrollBar, 0)->get_range() );
	
	
	VBoxContainer *mi_nna_vb = mi_hb->add( new VBoxContainer, 1);
	
	MarginGroup *mi_mg_nna=mi_nna_vb->add( new MarginGroup("New Note Action"),1);
	CenterContainer *mi_nna_cc=mi_mg_nna->add( new CenterContainer );
	
	VBoxContainer *mi_nna_vb_buttons = new VBoxContainer;
	
	mi_nna_cc->set_frame(mi_nna_vb_buttons);
	
	nna_group.add( mi_nna_vb_buttons->add( new Button("Note Cut"),0 ) );
	nna_group.add( mi_nna_vb_buttons->add( new Button("Note Continue"),0 ) );
	nna_group.add( mi_nna_vb_buttons->add( new Button("Note Off"),0 ) );
	nna_group.add( mi_nna_vb_buttons->add( new Button("Note Fade"),0 ) );
	nna_group.current_button_changed_signal.connect(this, &InstrumentScreen::parameter_changed_i );
	
	
	HBoxContainer *mi_nna_hb=mi_nna_vb->add( new HBoxContainer,1);
	
	MarginGroup *mi_nna_mg_dct=mi_nna_hb->add( new MarginGroup("Dup. Check"), 1 );
	
	CenterContainer *mi_dct_cc=mi_nna_mg_dct->add( new CenterContainer );
		
	VBoxContainer *mi_dct_vb_buttons = new VBoxContainer;
	
	mi_dct_cc->set_frame(mi_dct_vb_buttons);
	
	dct_group.add( mi_dct_vb_buttons->add( new Button("Disabled"),0 ) );
	dct_group.add( mi_dct_vb_buttons->add( new Button("Note"),0 ) );
	dct_group.add( mi_dct_vb_buttons->add( new Button("Sample"),0 ) );
	dct_group.add( mi_dct_vb_buttons->add( new Button("Instrument"),0 ) );
	dct_group.current_button_changed_signal.connect(this, &InstrumentScreen::parameter_changed_i );
	

	MarginGroup *mi_nna_mg_dca=mi_nna_hb->add( new MarginGroup("Dup. Action"), 1 );
	
	CenterContainer *mi_dca_cc=mi_nna_mg_dca->add( new CenterContainer );
		
	VBoxContainer *mi_dca_vb_buttons = new VBoxContainer;
	
	mi_dca_cc->set_frame(mi_dca_vb_buttons);
	
	dca_group.add( mi_dca_vb_buttons->add( new Button("Note Cut"),0 ) );
	dca_group.add( mi_dca_vb_buttons->add( new Button("Note Off"),0 ) );
	dca_group.add( mi_dca_vb_buttons->add( new Button("Note Fade"),0 ) );
	dca_group.current_button_changed_signal.connect(this, &InstrumentScreen::parameter_changed_i );
	
	/* Volume Section */
	
	VBoxContainer *vol_vb=sections->add( "Volume", new VBoxContainer );
	
	vol_envelope=vol_vb->add( new EnvelopeEditor(p_tracker->editor,p_mini) ,1 );
	
	mg=vol_vb->add( new MarginGroup("Volume Parameters"),0);
	GridContainer * gr = mg->add( new GridContainer(6), 1 );
	
	gr->add( new Label("Global"), false, false );
	
	
	vol_global_send = gr->add( new HSlider, true, false );
	vol_global_send->get_range()->set_max( 128 );
	vol_global_send->get_range()->value_changed_signal.connect(this,&InstrumentScreen::parameter_changed_p );

	gr->add( new ValueLabel,false,false)->set_range(vol_global_send->get_range());
	
	
	
	gr->add( new Label("Fade"), false, false );
	
	vol_fadeout = gr->add( new HSlider, true, false );
	vol_fadeout->get_range()->set_max( 256 );
	vol_fadeout->get_range()->value_changed_signal.connect(this,&InstrumentScreen::parameter_changed_p );
	
	gr->add( new ValueLabel,false,false)->set_range(vol_fadeout->get_range());
	
	gr->add( new Label("Random"), false, false );
	
	vol_random_send = gr->add( new HSlider, true, false );
	vol_random_send->get_range()->set_max( 100 );
	vol_random_send->get_range()->value_changed_signal.connect(this,&InstrumentScreen::parameter_changed_p );
	gr->add( new ValueLabel,false,false)->set_range(vol_random_send->get_range());
	
	/* Pan Section */
	
	VBoxContainer *pan_vb=sections->add( "Pan", new VBoxContainer );
	
	pan_envelope=pan_vb->add( new EnvelopeEditor(p_tracker->editor,p_mini),1 );
	
	
	mg=pan_vb->add( new MarginGroup("Panning Parameters"),0);
	gr = mg->add( new GridContainer(6), 1 );
	
	pan_use_default = gr->add( new CheckButton("Default"), false, false );
	pan_use_default->pressed_signal.connect( this, &InstrumentScreen::parameter_changed );
	pan_default = gr->add( new HSlider, true, false );
	pan_default->get_range()->set_min(-32);	
	pan_default->get_range()->set_max(32);	
	pan_default->get_range()->value_changed_signal.connect(this,&InstrumentScreen::parameter_changed_p );
	gr->add( new ValueLabel,false,false)->set_range(pan_default->get_range());
	
	gr->add( new Label("PPan Sep"), false, false );
	
	pan_ppsep = gr->add( new HSlider, true, false );

	pan_ppsep->get_range()->set_min(-32);	
	pan_ppsep->get_range()->set_max(32);	
	pan_ppsep->get_range()->value_changed_signal.connect(this,&InstrumentScreen::parameter_changed_p );
	gr->add( new ValueLabel,false,false)->set_range(pan_ppsep->get_range());
	
	gr->add( new Label("Random"), false, false );
	
	pan_random = gr->add( new HSlider, true, false );
	pan_random->get_range()->set_max(64);	
	pan_random->get_range()->value_changed_signal.connect(this,&InstrumentScreen::parameter_changed_p );
	gr->add( new ValueLabel,false,false)->set_range(pan_random->get_range());
	
	gr->add( new Label("  Center"), false, false );
	
	pan_ppcenter = gr->add( new HSlider, true, false );
	pan_ppcenter->get_range()->set_max(Note::NOTES-1);	
	pan_ppcenter->get_range()->value_changed_signal.connect(this,&InstrumentScreen::parameter_changed_p );	
	gr->add( new ValueLabel,false,false)->set_range(pan_ppcenter->get_range());
	
	VBoxContainer *pitch_filter_vb=sections->add( "Pitch/Filter", new VBoxContainer );
	
	pitch_filter_envelope=pitch_filter_vb->add( new EnvelopeEditor(p_tracker->editor,p_mini),1 );
	
	mg=pitch_filter_vb->add( new MarginGroup("Filter"),0);
	gr = mg->add( new GridContainer(6), 1 );
	
	filter_cutoff_default = gr->add( new CheckButton("Cutoff"), false, false );
	filter_cutoff_default->pressed_signal.connect( this, &InstrumentScreen::parameter_changed );
	filter_cutoff=gr->add( new HSlider, true, false );
	filter_cutoff->get_range()->set_max( 127 );
	filter_cutoff->get_range()->value_changed_signal.connect(this,&InstrumentScreen::parameter_changed_p );	
	gr->add( new ValueLabel,false,false )->set_range( filter_cutoff->get_range() );
	
	filter_reso_default = gr->add( new CheckButton("Resonance"), false, false );
	filter_reso_default->pressed_signal.connect( this, &InstrumentScreen::parameter_changed );
	filter_reso=gr->add( new HSlider, true, false );
	filter_reso->get_range()->set_max( 127 );
	filter_reso->get_range()->value_changed_signal.connect(this,&InstrumentScreen::parameter_changed_p );		
	gr->add( new ValueLabel,false,false )->set_range( filter_reso->get_range() );
	
	env_use_as_filter = pitch_filter_envelope->get_control_box()->add( new CheckButton("Use as Filter"), 1 );
	env_use_as_filter->pressed_signal.connect( this, &InstrumentScreen::parameter_changed );
	
	
	
	
	/* Final */
	
	instrument_list->selected_signal.connect( this, &InstrumentScreen::instrument_selected );
	instrument_list->item_edited_signal.connect( this, &InstrumentScreen::instrument_name_edited );

	/* File Dialog */
	
	
	updating=true;
	selected=0;
	instrument_selected(0);
	
	file_dialog=0;
}
예제 #3
0
ScriptCreateDialog::ScriptCreateDialog() {

	/* DIALOG */

	/* Main Controls */

	GridContainer *gc = memnew(GridContainer);
	gc->set_columns(2);

	/* Error Messages Field */

	VBoxContainer *vb = memnew(VBoxContainer);

	HBoxContainer *hb = memnew(HBoxContainer);
	Label *l = memnew(Label);
	l->set_text(" - ");
	hb->add_child(l);
	error_label = memnew(Label);
	error_label->set_text(TTR("Error!"));
	error_label->set_align(Label::ALIGN_LEFT);
	hb->add_child(error_label);
	vb->add_child(hb);

	hb = memnew(HBoxContainer);
	l = memnew(Label);
	l->set_text(" - ");
	hb->add_child(l);
	path_error_label = memnew(Label);
	path_error_label->set_text(TTR("Error!"));
	path_error_label->set_align(Label::ALIGN_LEFT);
	hb->add_child(path_error_label);
	vb->add_child(hb);

	PanelContainer *pc = memnew(PanelContainer);
	pc->set_h_size_flags(Control::SIZE_FILL);
	pc->add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("bg", "Tree"));
	pc->add_child(vb);

	/* Margins */

	Control *empty_h = memnew(Control);
	empty_h->set_name("empty_h"); //duplicate() doesn't like nodes without a name
	empty_h->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	empty_h->set_v_size_flags(Control::SIZE_EXPAND_FILL);
	empty_h->set_custom_minimum_size(Size2(0, 10 * EDSCALE));
	Control *empty_v = memnew(Control);
	empty_v->set_name("empty_v");
	empty_v->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	empty_v->set_v_size_flags(Control::SIZE_EXPAND_FILL);
	empty_v->set_custom_minimum_size(Size2(10, 0 * EDSCALE));

	vb = memnew(VBoxContainer);
	vb->add_child(empty_h->duplicate());
	vb->add_child(gc);
	vb->add_child(empty_h->duplicate());
	vb->add_child(pc);
	vb->add_child(empty_h->duplicate());
	hb = memnew(HBoxContainer);
	hb->add_child(empty_v->duplicate());
	hb->add_child(vb);
	hb->add_child(empty_v->duplicate());

	memdelete(empty_h);
	memdelete(empty_v);

	add_child(hb);

	/* Language */

	language_menu = memnew(OptionButton);
	language_menu->set_custom_minimum_size(Size2(250, 0) * EDSCALE);
	language_menu->set_h_size_flags(SIZE_EXPAND_FILL);
	l = memnew(Label);
	l->set_text(TTR("Language"));
	l->set_align(Label::ALIGN_RIGHT);
	gc->add_child(l);
	gc->add_child(language_menu);

	int default_lang = 0;
	for (int i = 0; i < ScriptServer::get_language_count(); i++) {

		String lang = ScriptServer::get_language(i)->get_name();
		language_menu->add_item(lang);
		if (lang == "GDScript") {
			default_lang = i;
		}
	}

	String last_selected_language = EditorSettings::get_singleton()->get_project_metadata("script_setup", "last_selected_language", "");
	if (last_selected_language != "") {
		for (int i = 0; i < language_menu->get_item_count(); i++) {
			if (language_menu->get_item_text(i) == last_selected_language) {
				language_menu->select(i);
				current_language = i;
				break;
			}
		}
	} else {
		language_menu->select(default_lang);
		current_language = default_lang;
	}

	language_menu->connect("item_selected", this, "_lang_changed");

	/* Inherits */

	hb = memnew(HBoxContainer);
	hb->set_h_size_flags(SIZE_EXPAND_FILL);
	parent_name = memnew(LineEdit);
	parent_name->connect("text_changed", this, "_parent_name_changed");
	parent_name->set_h_size_flags(SIZE_EXPAND_FILL);
	hb->add_child(parent_name);
	parent_browse_button = memnew(Button);
	parent_browse_button->set_flat(true);
	parent_browse_button->connect("pressed", this, "_browse_path", varray(true));
	hb->add_child(parent_browse_button);
	l = memnew(Label);
	l->set_text(TTR("Inherits"));
	l->set_align(Label::ALIGN_RIGHT);
	gc->add_child(l);
	gc->add_child(hb);
	is_browsing_parent = false;

	/* Class Name */

	class_name = memnew(LineEdit);
	class_name->connect("text_changed", this, "_class_name_changed");
	class_name->set_h_size_flags(SIZE_EXPAND_FILL);
	l = memnew(Label);
	l->set_text(TTR("Class Name"));
	l->set_align(Label::ALIGN_RIGHT);
	gc->add_child(l);
	gc->add_child(class_name);

	/* Templates */

	template_menu = memnew(OptionButton);
	l = memnew(Label);
	l->set_text(TTR("Template"));
	l->set_align(Label::ALIGN_RIGHT);
	gc->add_child(l);
	gc->add_child(template_menu);
	template_menu->connect("item_selected", this, "_template_changed");

	/* Built-in Script */

	internal = memnew(CheckButton);
	internal->connect("pressed", this, "_built_in_pressed");
	hb = memnew(HBoxContainer);
	hb->add_child(internal);
	l = memnew(Label);
	l->set_text(TTR("Built-in Script"));
	l->set_align(Label::ALIGN_RIGHT);
	gc->add_child(l);
	gc->add_child(hb);

	/* Path */

	hb = memnew(HBoxContainer);
	file_path = memnew(LineEdit);
	file_path->connect("text_changed", this, "_path_changed");
	file_path->set_h_size_flags(SIZE_EXPAND_FILL);
	hb->add_child(file_path);
	path_button = memnew(Button);
	path_button->set_flat(true);
	path_button->connect("pressed", this, "_browse_path", varray(false));
	hb->add_child(path_button);
	l = memnew(Label);
	l->set_text(TTR("Path"));
	l->set_align(Label::ALIGN_RIGHT);
	gc->add_child(l);
	gc->add_child(hb);

	/* Dialog Setup */

	file_browse = memnew(EditorFileDialog);
	file_browse->connect("file_selected", this, "_file_selected");
	add_child(file_browse);
	get_ok()->set_text(TTR("Create"));
	alert = memnew(AcceptDialog);
	alert->set_as_minsize();
	alert->get_label()->set_autowrap(true);
	alert->get_label()->set_align(Label::ALIGN_CENTER);
	alert->get_label()->set_valign(Label::VALIGN_CENTER);
	alert->get_label()->set_custom_minimum_size(Size2(325, 60) * EDSCALE);
	add_child(alert);

	set_as_minsize();
	set_hide_on_ok(false);
	set_title(TTR("Attach Node Script"));

	is_parent_name_valid = false;
	is_class_name_valid = false;
	is_path_valid = false;

	has_named_classes = false;
	supports_built_in = false;
	can_inherit_from_file = false;
	is_built_in = false;

	is_new_script_created = true;
}
예제 #4
0
FindInFilesDialog::FindInFilesDialog() {

	set_custom_minimum_size(Size2(500 * EDSCALE, 0));
	set_title(TTR("Find in Files"));

	VBoxContainer *vbc = memnew(VBoxContainer);
	vbc->set_anchor_and_margin(MARGIN_LEFT, ANCHOR_BEGIN, 8 * EDSCALE);
	vbc->set_anchor_and_margin(MARGIN_TOP, ANCHOR_BEGIN, 8 * EDSCALE);
	vbc->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, -8 * EDSCALE);
	vbc->set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, -8 * EDSCALE);
	add_child(vbc);

	GridContainer *gc = memnew(GridContainer);
	gc->set_columns(2);
	vbc->add_child(gc);

	Label *find_label = memnew(Label);
	find_label->set_text(TTR("Find:"));
	gc->add_child(find_label);

	_search_text_line_edit = memnew(LineEdit);
	_search_text_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
	_search_text_line_edit->connect("text_changed", this, "_on_search_text_modified");
	_search_text_line_edit->connect("text_entered", this, "_on_search_text_entered");
	gc->add_child(_search_text_line_edit);

	gc->add_child(memnew(Control)); // Space to maintain the grid aligned.

	{
		HBoxContainer *hbc = memnew(HBoxContainer);

		_whole_words_checkbox = memnew(CheckBox);
		_whole_words_checkbox->set_text(TTR("Whole Words"));
		hbc->add_child(_whole_words_checkbox);

		_match_case_checkbox = memnew(CheckBox);
		_match_case_checkbox->set_text(TTR("Match Case"));
		hbc->add_child(_match_case_checkbox);

		gc->add_child(hbc);
	}

	Label *folder_label = memnew(Label);
	folder_label->set_text(TTR("Folder:"));
	gc->add_child(folder_label);

	{
		HBoxContainer *hbc = memnew(HBoxContainer);

		Label *prefix_label = memnew(Label);
		prefix_label->set_text("res://");
		hbc->add_child(prefix_label);

		_folder_line_edit = memnew(LineEdit);
		_folder_line_edit->set_h_size_flags(SIZE_EXPAND_FILL);
		hbc->add_child(_folder_line_edit);

		Button *folder_button = memnew(Button);
		folder_button->set_text("...");
		folder_button->connect("pressed", this, "_on_folder_button_pressed");
		hbc->add_child(folder_button);

		_folder_dialog = memnew(FileDialog);
		_folder_dialog->set_mode(FileDialog::MODE_OPEN_DIR);
		_folder_dialog->connect("dir_selected", this, "_on_folder_selected");
		add_child(_folder_dialog);

		gc->add_child(hbc);
	}

	Label *filter_label = memnew(Label);
	filter_label->set_text(TTR("Filters:"));
	gc->add_child(filter_label);

	{
		HBoxContainer *hbc = memnew(HBoxContainer);

		// TODO: Unhardcode this.
		Vector<String> exts;
		exts.push_back("gd");
		if (Engine::get_singleton()->has_singleton("GodotSharp"))
			exts.push_back("cs");
		exts.push_back("shader");

		for (int i = 0; i < exts.size(); ++i) {
			CheckBox *cb = memnew(CheckBox);
			cb->set_text(exts[i]);
			cb->set_pressed(true);
			hbc->add_child(cb);
			_filters.push_back(cb);
		}

		gc->add_child(hbc);
	}

	_find_button = add_button(TTR("Find..."), false, "find");
	_find_button->set_disabled(true);

	_replace_button = add_button(TTR("Replace..."), false, "replace");
	_replace_button->set_disabled(true);

	Button *cancel_button = get_ok();
	cancel_button->set_text(TTR("Cancel"));
}
예제 #5
0
SampleScreen::SampleScreen(Tracker *p_tracker,bool p_mini) {

	
	mini_tabbox = p_mini?add(new TabBox,1):0;

	tracker=p_tracker;

	MarginGroup *mg=p_mini?mini_tabbox->add("List",new MarginGroup("Sample List")):add(new MarginGroup("Sample List"),3);
	
	mg->get_label_hb()->add( new Widget, 1);
	edit = mg->get_label_hb()->add( new MenuBox("File.."));
	edit->add_item( "Clear" );
	edit->add_separator();
	edit->add_item( "Load" );
	edit->add_item( "Save" );
	edit->add_separator();
	edit->add_item( "Copy" );
	edit->add_item( "Cut" );
	edit->add_item( "Paste" );
	edit->add_separator();
	edit->add_item( "Make Instrument" );
	edit->item_selected_signal.connect( this, &SampleScreen::sample_file_action_callback );
	
	HBoxContainer *slit_hb=mg->add(new HBoxContainer,1);
	
	sample_status=slit_hb->add( new SampleStatusList(p_tracker),0);
	sample_list=slit_hb->add( new List, 1 );
	slit_hb->add( new VScrollBar, 0 )->set_range( sample_list->get_range() );
	sample_status->set_range( sample_list->get_range() );
	
	for (int i=0;i<Song::MAX_SAMPLES;i++)
		sample_list->add_string( "" );
	
	sample_list->set_number_elements( 1 );
	sample_list->set_number_min_integers( 2 );
	sample_list->set_editable( true );
	sample_list->set_max_string_length( 25 );
	sample_list->set_incremental_search(false);
	
	mg=p_mini?mini_tabbox->add("Edit",new MarginGroup("Edit:")):add(new MarginGroup("Parameters:"),5);
	
	mg->get_label_hb()->add( new Widget, 1);
	
//	mg->get_label_hb()->add( new Widget, 1);
	sample_edit = mg->get_label_hb()->add( new MenuBox("Edit"));
	sample_edit->add_item("Copy",SampleEditorEffects::CMD_COPY);
	sample_edit->add_item("Cut",SampleEditorEffects::CMD_CUT);
	sample_edit->add_item("Paste",SampleEditorEffects::CMD_PASTE);
	sample_edit->add_item("Trim",SampleEditorEffects::CMD_TRIM);
	sample_edit->add_separator();
	sample_edit->add_item("PreLoop Cut",SampleEditorEffects::CMD_PRELOOP_CUT);
	sample_edit->add_item("PostLoop Cut",SampleEditorEffects::CMD_POSTLOOP_CUT);
	sample_edit->add_separator();
	sample_edit->add_item("Selection->Loop",SampleEditorEffects::CMD_SEL_TO_LOOP);
	sample_edit->add_item("Align Loop by Resizing",SampleEditorEffects::CMD_LOOP_TO_BOUNDARY);
	sample_edit->add_separator();
	sample_edit->add_item("Unroll Loop",SampleEditorEffects::CMD_LOOP_UNROLL);
	
	sample_edit->item_selected_signal.connect(this,&SampleScreen::sample_data_edit_menu_callback);
	sample_edit->add_separator();
	sample_edit->add_item("Insert Silence at End",SampleEditorEffects::CMD_ADD_SILENCE_AT_END);
	sample_edit->add_separator();
	sample_edit->add_item("Align Loop (ALL SAMPLES)",SampleEditor::CMD_ALIGN_SALL_SAMPLES);
	sample_edit->add_item("Unroll Loop (ALL SAMPLES)",SampleEditor::CMD_UNROLL_ALL_LOOPS);
	sample_edit->add_item("Convert to 16 (ALL SAMPLES)",SampleEditor::CMD_CONVERT_ALL_TO_16);
	sample_edit->add_item("Amplify All (ALL SAMPLES)",SampleEditor::CMD_AMPLIFY_ALL);
	
	
	sample_fx = mg->get_label_hb()->add( new MenuBox("FX"));
	sample_fx->add_item("Toggle Sign",SampleEditorEffects::CMD_TOGGLE_SIGN);
	sample_fx->add_item("Toggle Depth",SampleEditorEffects::CMD_TOGGLE_DEPTH);
	sample_fx->add_item("Toggle Stereo",SampleEditorEffects::CMD_TOGGLE_STEREO);
	sample_fx->add_item("Swap Stereo Chans",SampleEditorEffects::CMD_SWAP_STEREO_CHANS);
	sample_fx->add_separator();
	sample_fx->add_item("Amplify",SampleEditorEffects::CMD_AMPLIFY);
	sample_fx->add_item("Punch Envelope",SampleEditorEffects::CMD_PUNCH_ENVELOPE);
	sample_fx->add_item("Fade In",SampleEditorEffects::CMD_FADE_IN);
	sample_fx->add_item("Fade Out",SampleEditorEffects::CMD_FADE_OUT);
	sample_fx->add_separator();
	sample_fx->add_item("Center",SampleEditorEffects::CMD_CENTER);
	sample_fx->add_item("Reverse",SampleEditorEffects::CMD_REVERSE);
	sample_fx->add_separator();
	sample_fx->add_item("Fix Looping",SampleEditorEffects::CMD_FIX_LOOPING);
	sample_fx->add_item("Resample (Frames)",SampleEditorEffects::CMD_RESAMPLE);
	sample_fx->add_item("Resample (hz)",SampleEditorEffects::CMD_RESAMPLE_FREQ);
	sample_fx->add_item("Delay Left Channel",SampleEditorEffects::CMD_LEFT_CHAN_DELAY);
	sample_fx->add_item("Match Loop End",SampleEditorEffects::CMD_MATCH_LOOP_END_BY_NOTE);
	sample_fx->add_separator();
	sample_fx->add_item("Reverb",SampleEditor::CMD_REVERB);
	
	sample_fx->item_selected_signal.connect(this,&SampleScreen::sample_data_edit_menu_callback);
	
	sample_properties =mg->add( new VBoxContainer, 1 );
	
	sample_list->selected_signal.connect( this, &SampleScreen::list_sample_selected );
	sample_list->item_edited_signal.connect( this, &SampleScreen::sample_name_edited );
	
	sample_editor =  sample_properties->add( new SampleEditor(tracker->editor, tracker->mixer,p_mini), 1);
	
	if (!p_mini)
		sample_properties->add( new HSeparator,0 );
	/* Sample stuff */
	
	HBoxContainer *hbc = p_mini?sample_editor->get_mini_tabbox()->add("Vol/Pan/Vib",new HBoxContainer):sample_properties->add( new HBoxContainer, 0 );
	
	mg = hbc->add( new MarginGroup("Volume"),1);
	
	GridContainer *gc = mg->add( new GridContainer(3), 1);
	
	gc->add( new Label("Global"), false, false );
	
	global_volume=gc->add( new HSlider, true, false );
	gc->add( new ValueLabel, false, false )->set_range( global_volume->get_range() );
	
	global_volume->get_range()->value_changed_signal.connect( this, &SampleScreen::parameter_changed_p );
	
	gc->add( new Label("Default"), false, false );
	
	default_volume=gc->add( new HSlider, true, false );
	gc->add( new ValueLabel, false, false )->set_range( default_volume->get_range() );
	default_volume->get_range()->value_changed_signal.connect( this, &SampleScreen::parameter_changed_p );
	
	use_default_pan=gc->add( new CheckButton("Pan"), false, false );
	
	use_default_pan->pressed_signal.connect( this , &SampleScreen::parameter_changed );
	
	default_pan=gc->add( new HSlider, true, false );
	gc->add( new ValueLabel, false, false )->set_range( default_pan->get_range() );
	
	default_pan->get_range()->value_changed_signal.connect( this, &SampleScreen::parameter_changed_p );
	
	mg = hbc->add( new MarginGroup("Vibrato"),1);
	
	gc = mg->add( new GridContainer(3), 1);
	
	gc->add( new Label("Wave"), false, false );
	
	vibrato_type=gc->add( new ComboBox, true, false );
	
	vibrato_type->add_string( "Sine" );
	vibrato_type->add_string( "Saw" );
	vibrato_type->add_string( "Square" );
	vibrato_type->add_string( "Random" );
	
	vibrato_type->selected_signal.connect( this, &SampleScreen::parameter_changed_c );
	
	gc->add( new Widget, false, false );
	gc->add( new Label("Speed"), false, false );
	
	vibrato_speed=gc->add( new HSlider, true, false );
	gc->add( new ValueLabel, false, false )->set_range( vibrato_speed->get_range() );
	
	vibrato_speed->get_range()->value_changed_signal.connect( this, &SampleScreen::parameter_changed_p );
	
	gc->add( new Label("Depth"), false, false );
	
	vibrato_depth=gc->add( new HSlider, true, false );
	gc->add( new ValueLabel, false, false )->set_range( vibrato_depth->get_range() );
	
	vibrato_depth->get_range()->value_changed_signal.connect( this, &SampleScreen::parameter_changed_p );
	
	gc->add( new Label("Rate"), false, false );
	
	vibrato_rate=gc->add( new HSlider, true, false );
	gc->add( new ValueLabel, false, false )->set_range( vibrato_rate->get_range() );
	
	vibrato_rate->get_range()->value_changed_signal.connect( this, &SampleScreen::parameter_changed_p );
	
	global_volume->get_range()->set_max(64);
	default_volume->get_range()->set_max(64);
	default_pan->get_range()->set_min(-32);
	default_pan->get_range()->set_max(32);
	vibrato_speed->get_range()->set_max(64);
	vibrato_depth->get_range()->set_max(32);
	vibrato_rate->get_range()->set_max(64);
	
	selecting_outside=false;
	updating=false;	
	selected=0;	
	
	sample_file_dialog=0;
	file_dialog=0;
}
예제 #6
0
PluginConfigDialog::PluginConfigDialog() {
	get_ok()->set_disabled(true);
	set_hide_on_ok(true);

	GridContainer *grid = memnew(GridContainer);
	grid->set_columns(2);
	add_child(grid);

	Label *name_lb = memnew(Label);
	name_lb->set_text(TTR("Plugin Name:"));
	grid->add_child(name_lb);

	name_edit = memnew(LineEdit);
	name_edit->connect("text_changed", this, "_on_required_text_changed");
	name_edit->set_placeholder("MyPlugin");
	grid->add_child(name_edit);

	Label *subfolder_lb = memnew(Label);
	subfolder_lb->set_text(TTR("Subfolder:"));
	grid->add_child(subfolder_lb);

	subfolder_edit = memnew(LineEdit);
	subfolder_edit->set_placeholder("\"my_plugin\" -> res://addons/my_plugin");
	grid->add_child(subfolder_edit);

	Label *desc_lb = memnew(Label);
	desc_lb->set_text(TTR("Description:"));
	grid->add_child(desc_lb);

	desc_edit = memnew(TextEdit);
	desc_edit->set_custom_minimum_size(Size2(400, 80) * EDSCALE);
	grid->add_child(desc_edit);

	Label *author_lb = memnew(Label);
	author_lb->set_text(TTR("Author:"));
	grid->add_child(author_lb);

	author_edit = memnew(LineEdit);
	author_edit->set_placeholder("Godette");
	grid->add_child(author_edit);

	Label *version_lb = memnew(Label);
	version_lb->set_text(TTR("Version:"));
	grid->add_child(version_lb);

	version_edit = memnew(LineEdit);
	version_edit->set_placeholder("1.0");
	grid->add_child(version_edit);

	Label *script_option_lb = memnew(Label);
	script_option_lb->set_text(TTR("Language:"));
	grid->add_child(script_option_lb);

	script_option_edit = memnew(OptionButton);
	int default_lang = 0;
	for (int i = 0; i < ScriptServer::get_language_count(); i++) {
		ScriptLanguage *lang = ScriptServer::get_language(i);
		script_option_edit->add_item(lang->get_name());
		if (lang == GDScriptLanguage::get_singleton()) {
			default_lang = i;
		}
	}
	script_option_edit->select(default_lang);
	grid->add_child(script_option_edit);

	Label *script_lb = memnew(Label);
	script_lb->set_text(TTR("Script Name:"));
	grid->add_child(script_lb);

	script_edit = memnew(LineEdit);
	script_edit->connect("text_changed", this, "_on_required_text_changed");
	script_edit->set_placeholder("\"plugin.gd\" -> res://addons/my_plugin/plugin.gd");
	grid->add_child(script_edit);

	// TODO Make this option work better with languages like C#. Right now, it does not work because the C# project must be compiled first.
	Label *active_lb = memnew(Label);
	active_lb->set_text(TTR("Activate now?"));
	grid->add_child(active_lb);

	active_edit = memnew(CheckBox);
	active_edit->set_pressed(true);
	grid->add_child(active_edit);
}