Esempio n. 1
0
ProjectExportDialog::ProjectExportDialog() {

	set_title(TTR("Export"));
	set_resizable(true);

	VBoxContainer *main_vb = memnew(VBoxContainer);
	add_child(main_vb);
	HBoxContainer *hbox = memnew(HBoxContainer);
	main_vb->add_child(hbox);
	hbox->set_v_size_flags(SIZE_EXPAND_FILL);

	VBoxContainer *preset_vb = memnew(VBoxContainer);
	preset_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	hbox->add_child(preset_vb);

	HBoxContainer *preset_hb = memnew(HBoxContainer);
	preset_hb->add_child(memnew(Label(TTR("Presets"))));
	preset_hb->add_spacer();
	preset_vb->add_child(preset_hb);

	add_preset = memnew(MenuButton);
	add_preset->set_text(TTR("Add..."));
	add_preset->get_popup()->connect("index_pressed", this, "_add_preset");
	preset_hb->add_child(add_preset);
	MarginContainer *mc = memnew(MarginContainer);
	preset_vb->add_child(mc);
	mc->set_v_size_flags(SIZE_EXPAND_FILL);
	presets = memnew(ItemList);
	presets->set_drag_forwarding(this);
	mc->add_child(presets);
	presets->connect("item_selected", this, "_edit_preset");
	duplicate_preset = memnew(ToolButton);
	preset_hb->add_child(duplicate_preset);
	duplicate_preset->connect("pressed", this, "_duplicate_preset");
	delete_preset = memnew(ToolButton);
	preset_hb->add_child(delete_preset);
	delete_preset->connect("pressed", this, "_delete_preset");

	VBoxContainer *settings_vb = memnew(VBoxContainer);
	settings_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	hbox->add_child(settings_vb);

	name = memnew(LineEdit);
	settings_vb->add_margin_child(TTR("Name:"), name);
	name->connect("text_changed", this, "_name_changed");
	runnable = memnew(CheckButton);
	runnable->set_text(TTR("Runnable"));
	runnable->connect("pressed", this, "_runnable_pressed");
	settings_vb->add_child(runnable);

	sections = memnew(TabContainer);
	sections->set_tab_align(TabContainer::ALIGN_LEFT);
	settings_vb->add_child(sections);
	sections->set_v_size_flags(SIZE_EXPAND_FILL);

	parameters = memnew(EditorInspector);
	sections->add_child(parameters);
	parameters->set_name(TTR("Options"));
	parameters->set_v_size_flags(SIZE_EXPAND_FILL);
	parameters->connect("property_edited", this, "_update_parameters");

	VBoxContainer *resources_vb = memnew(VBoxContainer);
	sections->add_child(resources_vb);
	resources_vb->set_name(TTR("Resources"));

	export_filter = memnew(OptionButton);
	export_filter->add_item(TTR("Export all resources in the project"));
	export_filter->add_item(TTR("Export selected scenes (and dependencies)"));
	export_filter->add_item(TTR("Export selected resources (and dependencies)"));
	resources_vb->add_margin_child(TTR("Export Mode:"), export_filter);
	export_filter->connect("item_selected", this, "_export_type_changed");

	include_label = memnew(Label);
	include_label->set_text(TTR("Resources to export:"));
	resources_vb->add_child(include_label);
	include_margin = memnew(MarginContainer);
	include_margin->set_v_size_flags(SIZE_EXPAND_FILL);
	resources_vb->add_child(include_margin);

	include_files = memnew(Tree);
	include_margin->add_child(include_files);
	include_files->connect("item_edited", this, "_tree_changed");

	include_filters = memnew(LineEdit);
	resources_vb->add_margin_child(TTR("Filters to export non-resource files (comma separated, e.g: *.json, *.txt)"), include_filters);
	include_filters->connect("text_changed", this, "_filter_changed");

	exclude_filters = memnew(LineEdit);
	resources_vb->add_margin_child(TTR("Filters to exclude files from project (comma separated, e.g: *.json, *.txt)"), exclude_filters);
	exclude_filters->connect("text_changed", this, "_filter_changed");

	VBoxContainer *patch_vb = memnew(VBoxContainer);
	sections->add_child(patch_vb);
	patch_vb->set_name(TTR("Patches"));

	patches = memnew(Tree);
	patch_vb->add_child(patches);
	patches->set_v_size_flags(SIZE_EXPAND_FILL);
	patches->set_hide_root(true);
	patches->connect("button_pressed", this, "_patch_button_pressed");
	patches->connect("item_edited", this, "_patch_edited");
	patches->set_drag_forwarding(this);
	patches->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true);

	HBoxContainer *patches_hb = memnew(HBoxContainer);
	patch_vb->add_child(patches_hb);
	patches_hb->add_spacer();
	patch_export = memnew(Button);
	patch_export->set_text(TTR("Make Patch"));
	patches_hb->add_child(patch_export);
	patches_hb->add_spacer();

	patch_dialog = memnew(FileDialog);
	patch_dialog->add_filter("*.pck ; Pack File");
	patch_dialog->set_mode(FileDialog::MODE_OPEN_FILE);
	patch_dialog->connect("file_selected", this, "_patch_selected");
	add_child(patch_dialog);

	patch_erase = memnew(ConfirmationDialog);
	patch_erase->get_ok()->set_text(TTR("Delete"));
	patch_erase->connect("confirmed", this, "_patch_deleted");
	add_child(patch_erase);

	VBoxContainer *feature_vb = memnew(VBoxContainer);
	feature_vb->set_name(TTR("Features"));
	custom_features = memnew(LineEdit);
	custom_features->connect("text_changed", this, "_custom_features_changed");
	feature_vb->add_margin_child(TTR("Custom (comma-separated):"), custom_features);
	Panel *features_panel = memnew(Panel);
	custom_feature_display = memnew(RichTextLabel);
	features_panel->add_child(custom_feature_display);
	custom_feature_display->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 10 * EDSCALE);
	custom_feature_display->set_v_size_flags(SIZE_EXPAND_FILL);
	feature_vb->add_margin_child(TTR("Feature List:"), features_panel, true);
	sections->add_child(feature_vb);

	sections->connect("tab_changed", this, "_tab_changed");

	//disable by default
	name->set_editable(false);
	runnable->set_disabled(true);
	duplicate_preset->set_disabled(true);
	delete_preset->set_disabled(true);
	sections->hide();
	parameters->edit(NULL);

	delete_confirm = memnew(ConfirmationDialog);
	add_child(delete_confirm);
	delete_confirm->get_ok()->set_text(TTR("Delete"));
	delete_confirm->connect("confirmed", this, "_delete_preset_confirm");

	updating = false;

	get_cancel()->set_text(TTR("Close"));
	get_ok()->set_text(TTR("Export PCK/Zip"));
	export_button = add_button(TTR("Export Project"), !OS::get_singleton()->get_swap_ok_cancel(), "export");
	export_button->connect("pressed", this, "_export_project");
	// Disable initially before we select a valid preset
	export_button->set_disabled(true);

	export_pck_zip = memnew(FileDialog);
	export_pck_zip->add_filter("*.zip ; ZIP File");
	export_pck_zip->add_filter("*.pck ; Godot Game Pack");
	export_pck_zip->set_access(FileDialog::ACCESS_FILESYSTEM);
	export_pck_zip->set_mode(FileDialog::MODE_SAVE_FILE);
	add_child(export_pck_zip);
	export_pck_zip->connect("file_selected", this, "_export_pck_zip_selected");

	export_error = memnew(Label);
	main_vb->add_child(export_error);
	export_error->hide();
	export_error->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));

	export_templates_error = memnew(HBoxContainer);
	main_vb->add_child(export_templates_error);
	export_templates_error->hide();

	Label *export_error2 = memnew(Label);
	export_templates_error->add_child(export_error2);
	export_error2->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
	export_error2->set_text(" - " + TTR("Export templates for this platform are missing:") + " ");

	error_dialog = memnew(AcceptDialog);
	error_dialog->set_title("Error");
	error_dialog->set_text(TTR("Export templates for this platform are missing/corrupted:") + " ");
	main_vb->add_child(error_dialog);
	error_dialog->hide();

	LinkButton *download_templates = memnew(LinkButton);
	download_templates->set_text(TTR("Manage Export Templates"));
	download_templates->set_v_size_flags(SIZE_SHRINK_CENTER);
	export_templates_error->add_child(download_templates);
	download_templates->connect("pressed", this, "_open_export_template_manager");

	export_project = memnew(FileDialog);
	export_project->set_access(FileDialog::ACCESS_FILESYSTEM);
	add_child(export_project);
	export_project->connect("file_selected", this, "_export_project_to_path");
	export_project->get_line_edit()->connect("text_changed", this, "_validate_export_path");

	export_debug = memnew(CheckButton);
	export_debug->set_text(TTR("Export With Debug"));
	export_debug->set_pressed(true);
	export_project->get_vbox()->add_child(export_debug);

	export_pck_zip_debug = memnew(CheckButton);
	export_pck_zip_debug->set_text(TTR("Export With Debug"));
	export_pck_zip_debug->set_pressed(true);
	export_pck_zip->get_vbox()->add_child(export_pck_zip_debug);

	set_hide_on_ok(false);

	editor_icons = "EditorIcons";

	default_filename = EditorSettings::get_singleton()->get_project_metadata("export_options", "default_filename", "");
	// If no default set, use project name
	if (default_filename == "") {
		// If no project name defined, use a sane default
		default_filename = ProjectSettings::get_singleton()->get("application/config/name");
		if (default_filename == "") {
			default_filename = "UnnamedProject";
		}
	}
}
Esempio n. 2
0
FileDialog::FileDialog() {

	show_hidden_files=true;

	VBoxContainer *vbc = memnew( VBoxContainer );
	add_child(vbc);
	set_child_rect(vbc);

	mode=MODE_SAVE_FILE;
	set_title("Save a File");
	
	dir = memnew(LineEdit);
	HBoxContainer *pathhb = memnew( HBoxContainer );
	pathhb->add_child(dir);
	dir->set_h_size_flags(SIZE_EXPAND_FILL);

	drives = memnew( OptionButton );
	pathhb->add_child(drives);
	drives->connect("item_selected",this,"_select_drive");

	makedir = memnew( Button );
	makedir->set_text("Create Folder");
	makedir->connect("pressed",this,"_make_dir");
	pathhb->add_child(makedir);
	
	vbc->add_margin_child("Path:",pathhb);
	
	tree = memnew(Tree);
	tree->set_hide_root(true);
	vbc->add_margin_child("Directories & Files:",tree,true);
	
	file = memnew(LineEdit);
	//add_child(file);
	vbc->add_margin_child("File:",file);
	

	filter = memnew( OptionButton );
	//add_child(filter);
	vbc->add_margin_child("Filter:",filter);
	filter->set_clip_text(true);//too many extensions overflow it

	dir_access = DirAccess::create(DirAccess::ACCESS_RESOURCES);
	access=ACCESS_RESOURCES;
	_update_drives();

	
	connect("confirmed", this,"_action_pressed");
	//cancel->connect("pressed", this,"_cancel_pressed");
	tree->connect("cell_selected", this,"_tree_selected",varray(),CONNECT_DEFERRED);
	tree->connect("item_activated", this,"_tree_db_selected",varray());
	dir->connect("text_entered", this,"_dir_entered");
	file->connect("text_entered", this,"_file_entered");
	filter->connect("item_selected", this,"_filter_selected");

	
	confirm_save = memnew( ConfirmationDialog );
	confirm_save->set_as_toplevel(true);
	add_child(confirm_save);

	
	confirm_save->connect("confirmed", this,"_save_confirm_pressed");

	makedialog = memnew( ConfirmationDialog );
	makedialog->set_title("Create Folder");
	VBoxContainer *makevb= memnew( VBoxContainer );
	makedialog->add_child(makevb);
	makedialog->set_child_rect(makevb);
	makedirname = memnew( LineEdit );
	makevb->add_margin_child("Name:",makedirname);
	add_child(makedialog);
	makedialog->register_text_enter(makedirname);
	makedialog->connect("confirmed",this,"_make_dir_confirm");
	mkdirerr = memnew( AcceptDialog );
	mkdirerr->set_text("Could not create folder.");
	add_child(mkdirerr);

	exterr = memnew( AcceptDialog );
	exterr->set_text("Must use a valid extension.");
	add_child(exterr);


	//update_file_list();
	update_filters();
	update_dir();

	set_hide_on_ok(false);
	vbox=vbc;


	invalidated=true;
	if (register_func)
		register_func(this);
	
}
Esempio n. 3
0
int main() {
  FILE *file;
  // processing each line
  char line[128];
  char title[16];
  char centre[2];
  char filename[80];
  char t_str[10];
  int truncate;
  int frames;
  SNDFILE *wave_in;
  SF_INFO *wave_info;
  
  // running state
  int sample = 0;
  int pointer = 0;
  
  int i;
  
  // buffers
  unsigned char *buffer;
  float *wave_buffer;
  unsigned char *firmware;
  
  firmware = malloc(FIRMWARE_SIZE*sizeof(char));

  buffer=malloc(1024*1024*sizeof(unsigned char));
  memset(buffer,0x80,1024*1024*sizeof(unsigned char));
  
  wave_buffer = malloc(1024*1024*sizeof(float));
  wave_info = (SF_INFO *) malloc(sizeof(SF_INFO));  

  file = fopen("hr16b.bin", "rb");
  if(!file) {
    printf("can't open firmware image\n");
    exit(1);
  }
  
  fread(firmware,1,FIRMWARE_SIZE,file);
  fclose(file);
  flip(firmware);
  
  file = fopen("samplelist.txt", "rb");
  if(!file) {
    printf("can't open sample list\n");
    exit(1);
  }

  
  


  
  while (fgets(line, 128, file)) {

    centre[0]=0x00;

    sscanf(line, "%[^:]:%[^:]:%[^:]:%[^:]", title, centre, filename, t_str);
    
    //sscanf(line, "%[^:]:%[^:]:%[^:]", title, centre, filename);


    if (!(wave_in = sf_open(filename,SFM_READ,wave_info))) {
      printf("Failed to read sample %s\n", filename);
    }

    frames = wave_info->frames;
    truncate = atoi(t_str);
    if (truncate>0) frames=truncate;

    sf_readf_float(wave_in,wave_buffer,frames);

    sf_close(wave_in);

    for (i=0; i< frames; i++) {
      buffer[i+pointer] = 127*(wave_buffer[i]);
    }
    set_title(firmware, sample+1, title, 1);

    printf("pointer = %d (%05x)\nframes = %d (%05x)\n",pointer,pointer,frames, frames);
    frames += 2; // make sure there are at least two stop bytes
    frames = (frames & 0xffff0)+0x10;
    printf("frames = %d (%05x)\n\n",frames, frames);
    
    set_offset(firmware, sample+1, pointer);
    
    pointer += frames;
    sample++;

    //printf("%s:\n%d frames\n%d channels\n", title, wave_info->channels, wave_info->frames);

  }



  fclose(file);
  
  file = fopen("sample1.bin","wb");
  fwrite(buffer,1,524288,file);
  fclose(file);

  file = fopen("sample2.bin","wb");
  fwrite(buffer+524288,1,524288,file);
  fclose(file);


  
  flip(firmware);
  file = fopen("out.bin","wb");
  fwrite(firmware, sizeof(char), FIRMWARE_SIZE, file);
  fclose(file);
  
  printf("%d samples with total size %d, %d%% used\n",sample, pointer, (int)(pointer/(1024*10.24)));
    printf("%x\n",firmware);
  free(firmware);
  free(wave_buffer);
  free(buffer);
  free(wave_info);

}
Esempio n. 4
0
//////////////////////////////////////////////////////////////////////////
// Default constructor
SelectEditUI::SelectEditUI(Manager* aManager, int type, int app, bool aBeingViewed) 
: aTable(11, 6, false),
  title("Please select a section to edit"),
  l1("General Information:", 0, 1, false),
  l2("Taken Courses:", 0, 1, false),
  l3("TA'd Courses:", 0, 1, false),
  l4("Work Experience:", 0, 1, false),
  e1("Edit"),
  e2("Edit"),
  e3("Edit"),
  e4("Edit"),
  cancelButton("Cancel Application"),
  doneButton("Done"), 
  uApp(0),
  gApp(0)
{
  manager = aManager;
  stuType = type;
  appNum  = app;
  beingViewed = aBeingViewed;
  set_default_size(500, 700);
  set_title("cuTAES");
  set_modal(true);
  set_position(Gtk::WIN_POS_CENTER_ALWAYS);
  set_deletable(false);
  beingViewedStuType = stuType;
  if(beingViewed){
    stuType = 0;
  }
  if (stuType == 0) {
    uApp = manager->getUGradApps()->getApp(appNum);
    appInfo.set_text("Application #" + Tools::intToString(appNum) + " for " + uApp->getCourse()->getName());
  }
  else {
    gApp = manager->getGradApps()->getApp(appNum);
    appInfo.set_text("Application #" + Tools::intToString(appNum) + " for " + gApp->getCourse()->getName());
  }

  add(aTable);
  fillTable();
  aTable.attach(title, 0, 6, 0, 1,Gtk::FILL,Gtk::FILL,0,10);
  aTable.attach(appInfo, 0, 6, 1, 2,Gtk::FILL,Gtk::FILL,0,10);
  aTable.attach(l1, 0, 6, 2, 3,Gtk::FILL,Gtk::FILL,15,0);
  aTable.attach(s1, 0, 4, 3, 4);
  aTable.attach(e1, 4, 6, 3, 4,Gtk::FILL,Gtk::SHRINK,15,0);
  if (stuType==0) {
    aTable.attach(l2, 0, 6, 4, 5,Gtk::FILL,Gtk::FILL,15,0);
    aTable.attach(s2, 0, 4, 5, 6);
    aTable.attach(e2, 4, 6, 5, 6,Gtk::FILL,Gtk::SHRINK,15,0);
  }
  aTable.attach(l3, 0, 6, 6, 7,Gtk::FILL,Gtk::FILL,15,0);
  aTable.attach(s3, 0, 4, 7, 8);
  aTable.attach(e3, 4, 6, 7, 8,Gtk::FILL,Gtk::SHRINK,15,0);
  aTable.attach(l4, 0, 6, 8, 9,Gtk::FILL,Gtk::FILL,15,0);
  aTable.attach(s4, 0, 4, 9, 10);
  aTable.attach(e4, 4, 6, 9, 10,Gtk::FILL,Gtk::SHRINK,15,0);
  if(!beingViewed)
    aTable.attach(cancelButton, 0, 2, 10, 11, Gtk::FILL,Gtk::FILL, 20, 20);
  aTable.attach(doneButton, 2, 6, 10, 11, Gtk::FILL, Gtk::FILL, 20, 20);

  cancelButton.signal_clicked().connect(
    sigc::bind<Glib::ustring>( sigc::mem_fun(*this, &SelectEditUI::on_cancelButton), "Cancel Application") );
  doneButton.signal_clicked().connect(
    sigc::bind<Glib::ustring>( sigc::mem_fun(*this, &SelectEditUI::on_doneButton), "Done") );
  e1.signal_clicked().connect(
    sigc::bind<Glib::ustring>( sigc::mem_fun(*this, &SelectEditUI::on_editInfoButton), "info") );
  e2.signal_clicked().connect(
    sigc::bind<Glib::ustring>( sigc::mem_fun(*this, &SelectEditUI::on_editEntryButton), "taken") );
  e3.signal_clicked().connect(
    sigc::bind<Glib::ustring>( sigc::mem_fun(*this, &SelectEditUI::on_editEntryButton), "ta") );
  e4.signal_clicked().connect(
    sigc::bind<Glib::ustring>( sigc::mem_fun(*this, &SelectEditUI::on_editEntryButton), "work") );
  
  show_all_children();
  //cout << "CONSTRUCT SelectEditUI" << endl;
}
Esempio n. 5
0
void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode, const String &p_select_type) {

	type_list.clear();
	ClassDB::get_class_list(&type_list);
	ScriptServer::get_global_class_list(&type_list);
	type_list.sort_custom<StringName::AlphCompare>();

	recent->clear();

	FileAccess *f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("create_recent." + base_type), FileAccess::READ);

	if (f) {

		TreeItem *root = recent->create_item();

		while (!f->eof_reached()) {
			String l = f->get_line().strip_edges();
			String name = l.split(" ")[0];

			if (ClassDB::class_exists(name) || ScriptServer::is_global_class(name)) {
				TreeItem *ti = recent->create_item(root);
				ti->set_text(0, l);
				ti->set_icon(0, EditorNode::get_singleton()->get_class_icon(l, base_type));
			}
		}

		memdelete(f);
	}

	favorites->clear();

	f = FileAccess::open(EditorSettings::get_singleton()->get_project_settings_dir().plus_file("favorites." + base_type), FileAccess::READ);

	favorite_list.clear();

	if (f) {

		while (!f->eof_reached()) {
			String l = f->get_line().strip_edges();

			if (l != String()) {
				favorite_list.push_back(l);
			}
		}

		memdelete(f);
	}

	_save_and_update_favorite_list();

	// Restore valid window bounds or pop up at default size.
	Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", Rect2());
	if (saved_size != Rect2()) {
		popup(saved_size);
	} else {
		popup_centered_clamped(Size2(900, 700) * EDSCALE, 0.8);
	}

	if (p_dont_clear) {
		search_box->select_all();
	} else {
		search_box->clear();
	}

	search_box->grab_focus();

	_update_search();

	is_replace_mode = p_replace_mode;

	if (p_replace_mode) {
		select_type(p_select_type);
		set_title(vformat(TTR("Change %s Type"), base_type));
		get_ok()->set_text(TTR("Change"));
	} else {
		set_title(vformat(TTR("Create New %s"), base_type));
		get_ok()->set_text(TTR("Create"));
	}
}
	EditorBitMaskImportDialog(EditorBitMaskImportPlugin *p_plugin) {

		plugin = p_plugin;


		set_title(TTR("Import BitMasks"));

		VBoxContainer *vbc = memnew(VBoxContainer);
		add_child(vbc);
		//set_child_rect(vbc);


		HBoxContainer *hbc = memnew(HBoxContainer);
		vbc->add_margin_child(TTR("Source Texture(s):"), hbc);

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

		Button * import_choose = memnew(Button);
		import_choose->set_text(" .. ");
		hbc->add_child(import_choose);

		import_choose->connect("pressed", this, "_browse");

		hbc = memnew(HBoxContainer);
		vbc->add_margin_child(TTR("Target Path:"), hbc);

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

		Button * save_choose = memnew(Button);
		save_choose->set_text(" .. ");
		hbc->add_child(save_choose);

		save_choose->connect("pressed", this, "_browse_target");

		file_select = memnew(EditorFileDialog);
		file_select->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
		add_child(file_select);
		file_select->set_mode(EditorFileDialog::MODE_OPEN_FILES);
		file_select->connect("files_selected", this, "_choose_files");

		List<String> extensions;
		ImageLoader::get_recognized_extensions(&extensions);
		file_select->clear_filters();
		for (int i = 0; i<extensions.size(); i++) {

			file_select->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper());
		}

		save_select = memnew(EditorDirDialog);
		add_child(save_select);

		//save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR);
		save_select->connect("dir_selected", this, "_choose_save_dir");

		get_ok()->connect("pressed", this, "_import");
		get_ok()->set_text(TTR("Import"));


		error_dialog = memnew(ConfirmationDialog);
		add_child(error_dialog);
		error_dialog->get_ok()->set_text(TTR("Accept"));
		//error_dialog->get_cancel()->hide();

		set_hide_on_ok(false);
	}
ExampleWindow::ExampleWindow(int which)
: m_box1(Gtk::ORIENTATION_VERTICAL),
  m_buttonQuit("Quit")
{
  set_title("Gtk::Box example");

  PackBox *pPackBox1, *pPackBox2, *pPackBox3, *pPackBox4, *pPackBox5;

  switch(which)
  {
    case 1:
    {
      m_Label1.set_text("Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0); set_homogeneous(false);");

      // Align the label to the left side.  We'll discuss this function and
      // others in the section on Widget Attributes.
      m_Label1.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START);

      // Pack the label into the vertical box (vbox box1).  Remember that
      // widgets added to a vbox will be packed one on top of the other in
      // order.
      m_box1.pack_start(m_Label1, Gtk::PACK_SHRINK);

      // Create a PackBox - homogeneous = false, spacing = 0,
      // options = Gtk::PACK_SHRINK, padding = 0
      pPackBox1 = Gtk::manage(new PackBox(false, 0, Gtk::PACK_SHRINK));
      m_box1.pack_start(*pPackBox1, Gtk::PACK_SHRINK);

      // Create a PackBox - homogeneous = false, spacing = 0,
      // options = Gtk::PACK_EXPAND_PADDING, padding = 0
      pPackBox2 = Gtk::manage(new PackBox(false, 0, Gtk::PACK_EXPAND_PADDING));
      m_box1.pack_start(*pPackBox2, Gtk::PACK_SHRINK);

      // Create a PackBox - homogeneous = false, spacing = 0,
      // options = Gtk::PACK_EXPAND_WIDGET, padding = 0
      pPackBox3 = Gtk::manage(new PackBox(false, 0, Gtk::PACK_EXPAND_WIDGET));
      m_box1.pack_start(*pPackBox3, Gtk::PACK_SHRINK);

      // pack the separator into the vbox.  Remember each of these
      // widgets are being packed into a vbox, so they'll be stacked
      // vertically.
      m_box1.pack_start(m_separator1, Gtk::PACK_SHRINK, 5);

      // create another new label, and show it.
      m_Label2.set_text("Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0); set_homogeneous(true);");
      m_Label2.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START);
      m_box1.pack_start(m_Label2, Gtk::PACK_SHRINK);

      // Args are: homogeneous, spacing, options, padding
      pPackBox4 = Gtk::manage(new PackBox(true, 0, Gtk::PACK_EXPAND_PADDING));
      m_box1.pack_start(*pPackBox4, Gtk::PACK_SHRINK);

      // Args are: homogeneous, spacing, options, padding
      pPackBox5 = Gtk::manage(new PackBox(true, 0, Gtk::PACK_EXPAND_WIDGET));
      m_box1.pack_start(*pPackBox5, Gtk::PACK_SHRINK);

      m_box1.pack_start(m_separator2, Gtk::PACK_SHRINK, 5);

      break;
    }

    case 2:
    {

      m_Label1.set_text("Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 10); set_homogeneous(false);");
      m_Label1.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START);
      m_box1.pack_start(m_Label1, Gtk::PACK_SHRINK);

      pPackBox1 = Gtk::manage(new PackBox(false, 10, Gtk::PACK_EXPAND_PADDING));
      m_box1.pack_start(*pPackBox1, Gtk::PACK_SHRINK);

      pPackBox2 = Gtk::manage(new PackBox(false, 10, Gtk::PACK_EXPAND_WIDGET));
      m_box1.pack_start(*pPackBox2, Gtk::PACK_SHRINK);

      m_box1.pack_start(m_separator1, Gtk::PACK_SHRINK, 5);

      m_Label2.set_text("Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0); set_homogeneous(false);");
      m_Label2.set_alignment(Gtk::ALIGN_START, Gtk::ALIGN_START);
      m_box1.pack_start(m_Label2, Gtk::PACK_SHRINK);

      pPackBox3 = Gtk::manage(new PackBox(false, 0, Gtk::PACK_SHRINK, 10));
      m_box1.pack_start(*pPackBox3, Gtk::PACK_SHRINK);

      pPackBox4 = Gtk::manage(new PackBox(false, 0, Gtk::PACK_EXPAND_WIDGET, 10));
      m_box1.pack_start(*pPackBox4, Gtk::PACK_SHRINK);

      m_box1.pack_start(m_separator2, Gtk::PACK_SHRINK, 5);

      break;
    }

    case 3:
    {
      // This demonstrates the ability to use Gtk::Box::pack_end() to
      // right justify widgets.  First, we create a new box as before.
      pPackBox1 = Gtk::manage(new PackBox(false, 0, Gtk::PACK_SHRINK));

      // create the label that will be put at the end.
      m_Label1.set_text("end");

      // pack it using pack_end(), so it is put on the right side
      // of the PackBox.
      pPackBox1->pack_end(m_Label1, Gtk::PACK_SHRINK);

      m_box1.pack_start(*pPackBox1, Gtk::PACK_SHRINK);

      // this explicitly sets the separator to 500 pixels wide by 5 pixels
      // high.  This is so the hbox we created will also be 500 pixels wide,
      // and the "end" label will be separated from the other labels in the
      // hbox.  Otherwise, all the widgets in the hbox would be packed as
      // close together as possible.
      m_separator1.set_size_request(500, 5);

      // pack the separator into the vbox.
      m_box1.pack_start(m_separator1, Gtk::PACK_SHRINK, 5);

      break;
    }

    default:
    {
      std::cerr << "Unexpected command-line option." << std::endl;
      break;
    }
  }

  // Connect the signal to hide the window:
  m_buttonQuit.signal_clicked().connect( sigc::mem_fun(*this,
              &ExampleWindow::on_button_quit_clicked) );

  // pack the button into the quitbox.
  // The last 2 arguments to Box::pack_start are: options, padding.
  m_boxQuit.pack_start(m_buttonQuit, Gtk::PACK_EXPAND_PADDING);
  m_box1.pack_start(m_boxQuit, Gtk::PACK_SHRINK);

  // pack the vbox (box1) which now contains all our widgets, into the
  // main window.
  add(m_box1);

  show_all_children();
}
Esempio n. 8
0
    Window() : canvas(), checkbutton1("Plot 1"),
      checkbutton2("Plot 2"), checkbutton3("Plot 3"),
      label_x("X:"),
      label_y("Y:") {
      set_default_size(720, 580);
      Gdk::Geometry geometry;
      geometry.min_aspect = geometry.max_aspect = double(720)/double(580);
      set_geometry_hints(*this, geometry, Gdk::HINT_ASPECT);
      set_title("Gtkmm-PLplot test4");
      canvas.set_hexpand(true);
      canvas.set_vexpand(true);
      canvas.set_background_color(Gdk::RGBA("Light Gray"));
      grid.set_column_homogeneous(true);
      checkbutton1.set_vexpand(false);
      checkbutton1.set_hexpand(false);
      checkbutton1.set_halign(Gtk::ALIGN_CENTER);
      checkbutton2.set_vexpand(false);
      checkbutton2.set_hexpand(false);
      checkbutton2.set_halign(Gtk::ALIGN_CENTER);
      checkbutton3.set_vexpand(false);
      checkbutton3.set_hexpand(false);
      checkbutton3.set_halign(Gtk::ALIGN_CENTER);

      std::valarray<double> x_va = Gtk::PLplot::indgen_va(1000)/50.0 - 10.0;
      std::valarray<double> y_va1 = sinh(x_va);
      std::valarray<double> y_va2 = cosh(x_va);
      std::valarray<double> y_va3 = tanh(x_va);

      //generate the data, the plot, add them to the canvas and use the return value to pass it to the checkbutton
      Gtk::PLplot::Plot2D *plot1 = Gtk::manage(
        new Gtk::PLplot::Plot2D(
          *Gtk::manage(
            new Gtk::PLplot::PlotData2D(
              x_va,
              y_va1,
              Gdk::RGBA("blue"),
              Gtk::PLplot::LineStyle::CONTINUOUS,
              3.0
            )
          ),
          "X-axis",
          "Y-axis",
          "Hyperbolic sine",
          0.5,
          0.5,
          0.0,
          0.0
        )
      );
      canvas.add_plot(*plot1);
      checkbutton1.connect_plot(plot1);

      Gtk::PLplot::Plot2D *plot2 = Gtk::manage(
        new Gtk::PLplot::Plot2D(
          *Gtk::manage(
            new Gtk::PLplot::PlotData2D(
              x_va,
              y_va2,
              Gdk::RGBA("red"),
              Gtk::PLplot::LineStyle::CONTINUOUS,
              3.0
            )
          ),
          "X-axis",
          "Y-axis",
          "Hyperbolic cosine",
          0.5,
          0.5,
          0.5,
          0.0
        )
      );
      canvas.add_plot(*plot2);
      checkbutton2.connect_plot(plot2);

      Gtk::PLplot::Plot2D *plot3 = Gtk::manage(
        new Gtk::PLplot::Plot2D(
          *Gtk::manage(
            new Gtk::PLplot::PlotData2D(
              x_va,
              y_va3,
              Gdk::RGBA("green"),
              Gtk::PLplot::LineStyle::CONTINUOUS,
              3.0
            )
          ),
          "X-axis",
          "Y-axis",
          "Hyperbolic tangent",
          0.4,
          0.4,
          0.2,
          0.55
        )
      );
      canvas.add_plot(*plot3);
      checkbutton3.connect_plot(plot3);

      checkbutton1.set_active();
      checkbutton2.set_active(false);
      checkbutton3.set_active();

      //let's make the first plot unpannable
      plot1->set_region_pannable(false);

      //let's override the background color of the second plot and hide it to make the surprise complete!!
      plot2->set_background_color(Gdk::RGBA("Yellow Green"));
      plot2->hide();

      //also let's disable the region selection, for no reason whatsoever!
      plot2->set_region_selectable(false);

      //let's override the default region of this plot, this is NOT influenced by set_region_selectable()!!!
      plot2->set_region(-10, 10, -10, 10);

      //we can also change some other colors
      plot2->set_axes_color(Gdk::RGBA("Blue"));
      plot2->set_titles_color(Gdk::RGBA("Purple"));
      plot2->set_box_style(Gtk::PLplot::BOX_TICKS_TICK_LABELS_MAIN_AXES_MAJOR_MINOR_TICK_GRID);

      //lets'give the third plot a nice opaque background color
      plot3->set_background_color(Gdk::RGBA("White"));

      //but disable zooming by scrolling
      plot3->set_region_zoomable(false);

      //and give it an unusual selection box
      plot3->set_region_selection_color(Gdk::RGBA("Purple"));
      plot3->set_region_selection_width(4.0);

      //hook up signal_cursor_motion to the entries
      unsigned int plotnr = 0;
      while (1) {
        try {
          Gtk::PLplot::Plot2D *plot = dynamic_cast<Gtk::PLplot::Plot2D *>(canvas.get_plot(plotnr++));
          plot->signal_cursor_motion().connect([this](double x, double y){
            entry_x.set_text(Glib::Ascii::dtostr(x));
            entry_y.set_text(Glib::Ascii::dtostr(y));
          });
        }
        catch (Gtk::PLplot::Exception &e) {
          break;
        }
      }

      grid.attach(checkbutton1, 0, 0, 1, 1);
      grid.attach(checkbutton2, 1, 0, 1, 1);
      grid.attach(checkbutton3, 2, 0, 1, 1);
      grid.attach(canvas, 0, 1, 3, 1);

      coordinates_grid.set_column_homogeneous(false);
      coordinates_grid.attach(label_x, 0, 0, 1, 1);
      coordinates_grid.attach(entry_x, 1, 0, 1, 1);
      coordinates_grid.attach(label_y, 2, 0, 1, 1);
      coordinates_grid.attach(entry_y, 3, 0, 1, 1);
      label_x.set_vexpand(false);
      label_x.set_hexpand(true);
      label_x.set_halign(Gtk::ALIGN_END);
      label_y.set_vexpand(false);
      label_y.set_hexpand(false);
      label_y.set_halign(Gtk::ALIGN_CENTER);
      entry_x.set_vexpand(false);
      entry_x.set_hexpand(false);
      entry_x.set_halign(Gtk::ALIGN_END);
      entry_y.set_vexpand(false);
      entry_y.set_hexpand(true);
      entry_y.set_halign(Gtk::ALIGN_START);
      coordinates_grid.set_column_spacing(5);
      grid.attach(coordinates_grid, 0, 2, 3, 1);
      grid.set_row_spacing(5);

      add(grid);
      set_border_width(10);
      grid.show_all();
    }
Esempio n. 9
0
const char* reconstruction(ImageModel* image_model,
                           unsigned int method_id,
                           const float* param_values,
                           bool check_b_table,
                           unsigned int thread_count)
{
    static std::string output_name;
    try
    {
        image_model->voxel.recon_report.clear();
        image_model->voxel.recon_report.str("");
        image_model->voxel.param = param_values;
        std::ostringstream out;
        if(method_id == 1) // DTI
        {
            image_model->voxel.need_odf = 0;
            image_model->voxel.output_jacobian = 0;
            image_model->voxel.output_mapping = 0;
            image_model->voxel.output_rdi = 0;
            image_model->voxel.scheme_balance = 0;
            image_model->voxel.half_sphere = 0;
            image_model->voxel.odf_deconvolusion = 0;
            image_model->voxel.odf_decomposition = 0;
        }
        else
        {
            out << ".odf" << image_model->voxel.ti.fold;// odf_order
            out << ".f" << image_model->voxel.max_fiber_number;
            if (image_model->voxel.need_odf)
                out << "rec";
            if (image_model->voxel.scheme_balance)
                out << ".bal";
            if (image_model->voxel.half_sphere)
                out << ".hs";
            if (image_model->voxel.csf_calibration && method_id == 4)
                out << ".csfc";
            else
                image_model->voxel.csf_calibration = false;
            if (image_model->voxel.odf_deconvolusion)
            {
                out << ".de" << param_values[2];
                if(image_model->voxel.odf_xyz[0] != 0 ||
                   image_model->voxel.odf_xyz[1] != 0 ||
                   image_model->voxel.odf_xyz[2] != 0)
                    out << ".at_" << image_model->voxel.odf_xyz[0]
                        << "_" << image_model->voxel.odf_xyz[1]
                        << "_" << image_model->voxel.odf_xyz[2];
            }
            if (image_model->voxel.odf_decomposition)
            {
                out << ".dec" << param_values[3] << "m" << (int)param_values[4];
                if(image_model->voxel.odf_xyz[0] != 0 ||
                   image_model->voxel.odf_xyz[1] != 0 ||
                   image_model->voxel.odf_xyz[2] != 0)
                    out << ".at_" << image_model->voxel.odf_xyz[0]
                        << "_" << image_model->voxel.odf_xyz[1]
                        << "_" << image_model->voxel.odf_xyz[2];
            }
        }

        // correct for b-table orientation
        if(check_b_table)
        {
            set_title("checking b-table");
            bool output_dif = image_model->voxel.output_diffusivity;
            bool output_tensor = image_model->voxel.output_tensor;
            image_model->voxel.output_diffusivity = false;
            image_model->voxel.output_tensor = false;
            image_model->reconstruct<dti_process>(thread_count);
            image_model->voxel.output_diffusivity = output_dif;
            image_model->voxel.output_tensor = output_tensor;
            std::vector<std::vector<float> > fib_fa(1);
            std::vector<std::vector<float> > fib_dir(1);
            fib_fa[0].swap(image_model->voxel.fib_fa);
            fib_dir[0].swap(image_model->voxel.fib_dir);

            const unsigned char order[18][6] = {
                                    {0,1,2,1,0,0},
                                    {0,1,2,0,1,0},
                                    {0,1,2,0,0,1},
                                    {0,2,1,1,0,0},
                                    {0,2,1,0,1,0},
                                    {0,2,1,0,0,1},
                                    {1,0,2,1,0,0},
                                    {1,0,2,0,1,0},
                                    {1,0,2,0,0,1},
                                    {1,2,0,1,0,0},
                                    {1,2,0,0,1,0},
                                    {1,2,0,0,0,1},
                                    {2,1,0,1,0,0},
                                    {2,1,0,0,1,0},
                                    {2,1,0,0,0,1},
                                    {2,0,1,1,0,0},
                                    {2,0,1,0,1,0},
                                    {2,0,1,0,0,1}};
            const char txt[18][6] = {"012fx","012fy","012fz",
                                     "021fx","021fy","021fz",
                                     "102fx","102fy","102fz",
                                     "120fx","120fy","120fz",
                                     "210fx","210fy","210fz",
                                     "201fx","201fy","201fz"};

            float result[18] = {0};
            float cur_score = evaluate_fib(image_model->voxel.dim,fib_fa,fib_dir).first;

            for(int i = 0;i < 18;++i)
            {
                std::vector<std::vector<float> > new_dir(fib_dir);
                flip_fib_dir(new_dir[0],order[i]);
                result[i] = evaluate_fib(image_model->voxel.dim,fib_fa,new_dir).first;
            }
            int best = std::max_element(result,result+18)-result;

            if(result[best] > cur_score)
            {
                out << "." << txt[best];
                image_model->flip_b_table(order[best]);
            }
        }


        switch (method_id)
        {
        case 0: //DSI local max
            image_model->voxel.recon_report <<
            " The diffusion data were reconstructed using diffusion spectrum imaging (Wedeen et al. MRM, 2005) with a Hanning filter of " << (int)param_values[0] << ".";
            if (image_model->voxel.odf_deconvolusion || image_model->voxel.odf_decomposition)
            {
                if (!image_model->reconstruct<dsi_estimate_response_function>(thread_count))
                    return "reconstruction canceled";
            }
            out << ".dsi."<< (int)param_values[0] << ".fib.gz";
            if (!image_model->reconstruct<dsi_process>(thread_count))
                return "reconstruction canceled";
            break;
        case 1://DTI
            image_model->voxel.recon_report << " The diffusion tensor was calculated.";
            out << ".dti.fib.gz";
            image_model->voxel.max_fiber_number = 1;
            if (!image_model->reconstruct<dti_process>(thread_count))
                return "reconstruction canceled";
            break;

        case 2://QBI
            image_model->voxel.recon_report << " The diffusion data was reconstructed using q-ball imaging (Tuch, MRM 2004).";
            if (image_model->voxel.odf_deconvolusion || image_model->voxel.odf_decomposition)
            {
                if (!image_model->reconstruct<qbi_estimate_response_function>(thread_count))
                    return "reconstruction canceled";
            }
            out << ".qbi."<< param_values[0] << "_" << param_values[1] << ".fib.gz";
            if (!image_model->reconstruct<qbi_process>(thread_count))
                return "reconstruction canceled";
            break;
        case 3://QBI
            image_model->voxel.recon_report << " The diffusion data was reconstructed using spherical-harmonic-based q-ball imaging (Descoteaux et al., MRM 2007).";
            if (image_model->voxel.odf_deconvolusion || image_model->voxel.odf_decomposition)
            {
                if (!image_model->reconstruct<qbi_sh_estimate_response_function>(thread_count))
                    return "reconstruction canceled";
            }
            out << ".qbi.sh"<< (int) param_values[1] << "." << param_values[0] << ".fib.gz";
            if (!image_model->reconstruct<qbi_sh_process>(thread_count))
                return "reconstruction canceled";
            break;

        case 4://GQI
            if(param_values[0] == 0.0) // spectral analysis
            {
                image_model->voxel.recon_report <<
                " The diffusion data were reconstructed using generalized q-sampling imaging (Yeh et al., IEEE TMI, ;29(9):1626-35, 2010).";
                out << (image_model->voxel.r2_weighted ? ".gqi2.spec.fib.gz":".gqi.spec.fib.gz");
                if (!image_model->reconstruct<gqi_spectral_process>(thread_count))
                    return "reconstruction canceled";
                break;
            }
            image_model->voxel.recon_report <<
            " The diffusion data were reconstructed using generalized q-sampling imaging (Yeh et al., IEEE TMI, ;29(9):1626-35, 2010) with a diffusion sampling length ratio of " << (float)param_values[0] << ".";
            if (image_model->voxel.odf_deconvolusion || image_model->voxel.odf_decomposition)
            {
                if (!image_model->reconstruct<gqi_estimate_response_function>(thread_count))
                    return "reconstruction canceled";
            }
            if(image_model->voxel.r2_weighted)
                image_model->voxel.recon_report << " The ODF calculation was weighted by the square of the diffuion displacement.";
            if (image_model->voxel.output_rdi)
                out << ".rdi";
            out << (image_model->voxel.r2_weighted ? ".gqi2.":".gqi.") << param_values[0] << ".fib.gz";
            if (!image_model->reconstruct<gqi_process>(thread_count))
                return "reconstruction canceled";
            break;
        case 6:
            image_model->voxel.recon_report
                    << " The diffusion data were converted to HARDI using generalized q-sampling method with a regularization parameter of " << param_values[2] << ".";
            out << ".hardi."<< param_values[0]
                << ".b" << param_values[1]
                << ".reg" << param_values[2] << ".src.gz";
            if (!image_model->reconstruct<hardi_convert_process>(thread_count))
                return "reconstruction canceled";
            break;
        case 7:
            image_model->voxel.recon_report
            << " The diffusion data were reconstructed in the MNI space using q-space diffeomorphic reconstruction (Yeh et al., Neuroimage, 58(1):91-9, 2011) to obtain the spin distribution function (Yeh et al., IEEE TMI, ;29(9):1626-35, 2010). "
            << " A diffusion sampling length ratio of "
            << (float)param_values[0] << " was used, and the output resolution was " << param_values[1] << " mm.";
            // run gqi to get the spin quantity
            std::vector<image::pointer_image<float,3> > tmp;
            tmp.swap(image_model->voxel.grad_dev);
            if (!image_model->reconstruct<gqi_estimate_response_function>(thread_count))
                return "reconstruction canceled";
            tmp.swap(image_model->voxel.grad_dev);
            out << ".reg" << (int)image_model->voxel.reg_method;
            out << "i" << (int)image_model->voxel.interpo_method;
            out << (image_model->voxel.r2_weighted ? ".qsdr2.":".qsdr.");
            out << param_values[0] << "." << param_values[1] << "mm";
            if(image_model->voxel.output_jacobian)
                out << ".jac";
            if(image_model->voxel.output_mapping)
                out << ".map";
            if (!image_model->reconstruct<gqi_mni_process>(thread_count))
                return "reconstruction canceled";
            out << ".R" << (int)std::floor(image_model->voxel.R2*100.0) << ".fib.gz";
            break;
        }
        image_model->save_fib(out.str());
        output_name = image_model->file_name + out.str();
    }
    catch (std::exception& e)
    {
        output_name = e.what();
        return output_name.c_str();
    }
    catch (...)
    {
        return "unknown exception";
    }
    return output_name.c_str();
}
Esempio n. 10
0
void do_mpmset( CHAR_DATA * ch, const char *argument )
{
	char arg1[MAX_INPUT_LENGTH];
	char arg2[MAX_INPUT_LENGTH];
	char arg3[MAX_INPUT_LENGTH];
	char buf[MAX_STRING_LENGTH];
	char log_buf[MAX_STRING_LENGTH];
	char outbuf[MAX_STRING_LENGTH];
	CHAR_DATA *victim;
	int value, v2;
	int minattr, maxattr;

	/*
	 * A desc means switched.. too many loopholes if we allow that.. 
	 */
	if ( !IS_NPC( ch ) || IS_AFFECTED( ch, AFF_CHARM ) || ch->desc )
	{
		send_to_char( "Huh?\r\n", ch );
		return;
	}

	smash_tilde( argument );

	argument = one_argument( argument, arg1 );
	argument = one_argument( argument, arg2 );
	mudstrlcpy( arg3, argument, MAX_INPUT_LENGTH );

	if ( !*arg1 )
	{
		progbug( "MpMset: no args", ch );
		return;
	}

	if ( ( victim = get_char_room( ch, arg1 ) ) == NULL )
	{
		progbug( "MpMset: no victim", ch );
		return;
	}

	if ( IS_IMMORTAL( victim ) )
	{
		send_to_char( "You can't do that!\r\n", ch );
		return;
	}

	if ( IS_NPC( victim ) && xIS_SET( victim->act, ACT_PROTOTYPE ) )
	{
		progbug( "MpMset: victim is proto", ch );
		return;
	}

	if ( IS_NPC( victim ) )
	{
		minattr = 1;
		maxattr = 25;
	}
	else
	{
		minattr = 3;
		maxattr = 18;
	}

	value = is_number( arg3 ) ? atoi( arg3 ) : -1;
	if ( atoi( arg3 ) < -1 && value == -1 )
		value = atoi( arg3 );

	if ( !str_cmp( arg2, "str" ) )
	{
		if ( value < minattr || value > maxattr )
		{
			progbug( "MpMset: Invalid str", ch );
			return;
		}
		victim->perm_str = value;
		return;
	}

	if ( !str_cmp( arg2, "int" ) )
	{
		if ( value < minattr || value > maxattr )
		{
			progbug( "MpMset: Invalid int", ch );
			return;
		}
		victim->perm_int = value;
		return;
	}

	if ( !str_cmp( arg2, "wis" ) )
	{
		if ( value < minattr || value > maxattr )
		{
			progbug( "MpMset: Invalid wis", ch );
			return;
		}
		victim->perm_wis = value;
		return;
	}

	if ( !str_cmp( arg2, "dex" ) )
	{
		if ( value < minattr || value > maxattr )
		{
			progbug( "MpMset: Invalid dex", ch );
			return;
		}
		victim->perm_dex = value;
		return;
	}

	if ( !str_cmp( arg2, "con" ) )
	{
		if ( value < minattr || value > maxattr )
		{
			progbug( "MpMset: Invalid con", ch );
			return;
		}
		victim->perm_con = value;
		return;
	}

	if ( !str_cmp( arg2, "cha" ) )
	{
		if ( value < minattr || value > maxattr )
		{
			progbug( "MpMset: Invalid cha", ch );
			return;
		}
		victim->perm_cha = value;
		return;
	}

	if ( !str_cmp( arg2, "lck" ) )
	{
		if ( value < minattr || value > maxattr )
		{
			progbug( "MpMset: Invalid lck", ch );
			return;
		}
		victim->perm_lck = value;
		return;
	}

	if ( !str_cmp( arg2, "sav1" ) )
	{
		if ( value < -30 || value > 30 )
		{
			progbug( "MpMset: Invalid sav1", ch );
			return;
		}
		victim->saving_poison_death = value;
		return;
	}

	if ( !str_cmp( arg2, "sav2" ) )
	{
		if ( value < -30 || value > 30 )
		{
			progbug( "MpMset: Invalid sav2", ch );
			return;
		}
		victim->saving_wand = value;
		return;
	}

	if ( !str_cmp( arg2, "sav3" ) )
	{
		if ( value < -30 || value > 30 )
		{
			progbug( "MpMset: Invalid sav3", ch );
			return;
		}
		victim->saving_para_petri = value;
		return;
	}

	if ( !str_cmp( arg2, "sav4" ) )
	{
		if ( value < -30 || value > 30 )
		{
			progbug( "MpMset: Invalid sav4", ch );
			return;
		}
		victim->saving_breath = value;
		return;
	}

	if ( !str_cmp( arg2, "sav5" ) )
	{
		if ( value < -30 || value > 30 )
		{
			progbug( "MpMset: Invalid sav5", ch );
			return;
		}
		victim->saving_spell_staff = value;
		return;
	}

	if ( !str_cmp( arg2, "sex" ) )
	{
		if ( value < 0 || value > 2 )
		{
			progbug( "MpMset: Invalid sex", ch );
			return;
		}
		victim->sex = value;
		return;
	}

	if ( !str_cmp( arg2, "class" ) )
	{
		if ( IS_NPC( victim ) )	/* Broken by Haus... fixed by Thoric */
		{
			if ( value >= MAX_NPC_CLASS || value < 0 )
			{
				progbug( "MpMset: Invalid npc class", ch );
				return;
			}
			victim->Class = value;
			return;
		}
		progbug( "MpMset: can't set pc class", ch );
	}

	if ( !str_cmp( arg2, "race" ) )
	{
		value = get_npc_race( arg3 );
		if ( value < 0 )
			value = atoi( arg3 );
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc race", ch );
			return;
		}
		if ( value < 0 || value >= MAX_NPC_RACE )
		{
			progbug( "MpMset: Invalid npc race", ch );
			return;
		}
		victim->race = value;
		return;
	}

	if ( !str_cmp( arg2, "armor" ) )
	{
		if ( value < -300 || value > 300 )
		{
			send_to_char( "AC range is -300 to 300.\r\n", ch );
			return;
		}
		victim->armor = value;
		return;
	}

	if ( !str_cmp( arg2, "level" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc level", ch );
			return;
		}

		if ( value < 0 || value > LEVEL_AVATAR + 5 )
		{
			progbug( "MpMset: Invalid npc level", ch );
			return;
		}
		victim->level = value;
		return;
	}

	if ( !str_cmp( arg2, "numattacks" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc numattacks", ch );
			return;
		}

		if ( value < 0 || value > 20 )
		{
			progbug( "MpMset: Invalid npc numattacks", ch );
			return;
		}
		victim->numattacks = value;
		return;
	}

	if ( !str_cmp( arg2, "gold" ) )
	{
		victim->gold = value;
		return;
	}

	if ( !str_cmp( arg2, "hitroll" ) )
	{
		victim->hitroll = URANGE( 0, value, 85 );
		return;
	}

	if ( !str_cmp( arg2, "damroll" ) )
	{
		victim->damroll = URANGE( 0, value, 65 );
		return;
	}

	if ( !str_cmp( arg2, "hp" ) )
	{
		if ( value < 1 || value > 32700 )
		{
			progbug( "MpMset: Invalid hp", ch );
			return;
		}
		victim->max_hit = value;
		return;
	}

	if ( !str_cmp( arg2, "mana" ) )
	{
		if ( value < 0 || value > 30000 )
		{
			progbug( "MpMset: Invalid mana", ch );
			return;
		}
		victim->max_mana = value;
		return;
	}

	if ( !str_cmp( arg2, "move" ) )
	{
		if ( value < 0 || value > 30000 )
		{
			progbug( "MpMset: Invalid move", ch );
			return;
		}
		victim->max_move = value;
		return;
	}

	if ( !str_cmp( arg2, "practice" ) )
	{
		if ( value < 0 || value > 100 )
		{
			progbug( "MpMset: Invalid practice", ch );
			return;
		}
		victim->practice = value;
		return;
	}

	if ( !str_cmp( arg2, "align" ) )
	{
		if ( value < -1000 || value > 1000 )
		{
			progbug( "MpMset: Invalid align", ch );
			return;
		}
		victim->alignment = value;
		return;
	}

/* non-functional for now -- Blod
    if ( !str_cmp( arg2, "quest" ) )
    {
	if ( IS_NPC(victim) )
	{
	    progbug("MpMset: can't set npc quest", ch);
	    return;
	}

	if ( value < 0 || value > 500 )
	{
	    progbug("MpMset: Invalid pc quest", ch);
	    return;
	}

	victim->pcdata->quest = value;
	return;
    }
*/

	if ( !str_cmp( arg2, "questplus" ) )
	{
		if ( IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set npc qp", ch );
			return;
		}

		if ( value < 0 || value > 5000 )
		{
			progbug( "MpMset: Invalid pc qp", ch );
			return;
		}
		snprintf( log_buf, MAX_STRING_LENGTH, "%s raising glory of %s by %d ...", ch->name, victim->name, value );
		log_string( log_buf );
		victim->pcdata->quest_curr += value;
		victim->pcdata->quest_accum += value;
		return;
	}

	if ( !str_cmp( arg2, "favor" ) )
	{
		if ( IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set npc favor", ch );
			return;
		}

		if ( value < -2500 || value > 2500 )
		{
			progbug( "MpMset: Invalid pc favor", ch );
			return;
		}

		victim->pcdata->favor = value;
		return;
	}

	if ( !str_cmp( arg2, "mentalstate" ) )
	{
		if ( value < -100 || value > 100 )
		{
			progbug( "MpMset: Invalid mentalstate", ch );
			return;
		}
		victim->mental_state = value;
		return;
	}

	if ( !str_cmp( arg2, "emotion" ) )
	{
		if ( value < -100 || value > 100 )
		{
			progbug( "MpMset: Invalid emotion", ch );
			return;
		}
		victim->emotional_state = value;
		return;
	}

	if ( !str_cmp( arg2, "thirst" ) )
	{
		if ( IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set npc thirst", ch );
			return;
		}

		if ( value < 0 || value > 100 )
		{
			progbug( "MpMset: Invalid pc thirst", ch );
			return;
		}

		victim->pcdata->condition[COND_THIRST] = value;
		return;
	}

	if ( !str_cmp( arg2, "drunk" ) )
	{
		if ( IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set npc drunk", ch );
			return;
		}

		if ( value < 0 || value > 100 )
		{
			progbug( "MpMset: Invalid pc drunk", ch );
			return;
		}

		victim->pcdata->condition[COND_DRUNK] = value;
		return;
	}

	if ( !str_cmp( arg2, "full" ) )
	{
		if ( IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set npc full", ch );
			return;
		}

		if ( value < 0 || value > 100 )
		{
			progbug( "MpMset: Invalid pc full", ch );
			return;
		}

		victim->pcdata->condition[COND_FULL] = value;
		return;
	}

	if ( !str_cmp( arg2, "blood" ) )
	{
		if ( IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set npc blood", ch );
			return;
		}

		if ( value < 0 || value > MAX_LEVEL + 10 )
		{
			progbug( "MpMset: Invalid pc blood", ch );
			return;
		}

		victim->pcdata->condition[COND_BLOODTHIRST] = value;
		return;
	}

	if ( !str_cmp( arg2, "name" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc name", ch );
			return;
		}

		STRFREE( victim->name );
		victim->name = STRALLOC( arg3 );
		return;
	}

	if ( !str_cmp( arg2, "deity" ) )
	{
		DEITY_DATA *deity;

		if ( IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set npc deity", ch );
			return;
		}

		if ( arg3[0] == '\0' )
		{
			STRFREE( victim->pcdata->deity_name );
			victim->pcdata->deity_name = STRALLOC( "" );
			victim->pcdata->deity = NULL;
			return;
		}

		deity = get_deity( arg3 );
		if ( !deity )
		{
			progbug( "MpMset: Invalid deity", ch );
			return;
		}
		STRFREE( victim->pcdata->deity_name );
		victim->pcdata->deity_name = QUICKLINK( deity->name );
		victim->pcdata->deity = deity;
		return;
	}

	if ( !str_cmp( arg2, "short" ) )
	{
		STRFREE( victim->short_descr );
		victim->short_descr = STRALLOC( arg3 );
		return;
	}

	if ( !str_cmp( arg2, "long" ) )
	{
		STRFREE( victim->long_descr );
		mudstrlcpy( buf, arg3, MAX_STRING_LENGTH );
		mudstrlcat( buf, "\r\n", MAX_STRING_LENGTH );
		victim->long_descr = STRALLOC( buf );
		return;
	}

	if ( !str_cmp( arg2, "title" ) )
	{
		if ( IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set npc title", ch );
			return;
		}

		set_title( victim, arg3 );
		return;
	}

	if ( !str_cmp( arg2, "spec" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc spec", ch );
			return;
		}

		if ( !str_cmp( arg3, "none" ) )
		{
			victim->spec_fun = NULL;
			return;
		}

		if ( ( victim->spec_fun = spec_lookup( arg3 ) ) == 0 )
		{
			progbug( "MpMset: Invalid spec", ch );
			return;
		}
		return;
	}

	if ( !str_cmp( arg2, "flags" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc flags", ch );
			return;
		}

		if ( !argument || argument[0] == '\0' )
		{
			progbug( "MpMset: no flags", ch );
			return;
		}
		while ( argument[0] != '\0' )
		{
			argument = one_argument( argument, arg3 );
			value = get_actflag( arg3 );
			if ( value < 0 || value >= MAX_BITS )
				progbug( "MpMset: Invalid flag", ch );
			else
			{
				if ( value == ACT_PROTOTYPE )
					progbug( "MpMset: can't set prototype flag", ch );
				else if ( value == ACT_IS_NPC )
					progbug( "MpMset: can't remove npc flag", ch );
				else
					xTOGGLE_BIT( victim->act, value );
			}
		}
		return;
	}

	if ( !str_cmp( arg2, "affected" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't modify pc affected", ch );
			return;
		}

		if ( !argument || argument[0] == '\0' )
		{
			progbug( "MpMset: no affected", ch );
			return;
		}
		while ( argument[0] != '\0' )
		{
			argument = one_argument( argument, arg3 );
			value = get_aflag( arg3 );
			if ( value < 0 || value >= MAX_BITS )
				progbug( "MpMset: Invalid affected", ch );
			else
				xTOGGLE_BIT( victim->affected_by, value );
		}
		return;
	}

	/*
	 * save some more finger-leather for setting RIS stuff
	 * Why there's can_modify checks here AND in the called function, Ill
	 * never know, so I removed them.. -- Alty
	 */
	if ( !str_cmp( arg2, "r" ) )
	{
		snprintf( outbuf, MAX_STRING_LENGTH, "%s resistant %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		return;
	}
	if ( !str_cmp( arg2, "i" ) )
	{
		snprintf( outbuf, MAX_STRING_LENGTH, "%s immune %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		return;
	}
	if ( !str_cmp( arg2, "s" ) )
	{
		snprintf( outbuf, MAX_STRING_LENGTH, "%s susceptible %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		return;
	}
	if ( !str_cmp( arg2, "ri" ) )
	{
		snprintf( outbuf, MAX_STRING_LENGTH, "%s resistant %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		snprintf( outbuf, MAX_STRING_LENGTH, "%s immune %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		return;
	}

	if ( !str_cmp( arg2, "rs" ) )
	{
		snprintf( outbuf, MAX_STRING_LENGTH, "%s resistant %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		snprintf( outbuf, MAX_STRING_LENGTH, "%s susceptible %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		return;
	}
	if ( !str_cmp( arg2, "is" ) )
	{
		snprintf( outbuf, MAX_STRING_LENGTH, "%s immune %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		snprintf( outbuf, MAX_STRING_LENGTH, "%s susceptible %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		return;
	}
	if ( !str_cmp( arg2, "ris" ) )
	{
		snprintf( outbuf, MAX_STRING_LENGTH, "%s resistant %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		snprintf( outbuf, MAX_STRING_LENGTH, "%s immune %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		snprintf( outbuf, MAX_STRING_LENGTH, "%s susceptible %s", arg1, arg3 );
		do_mpmset( ch, outbuf );
		return;
	}

	if ( !str_cmp( arg2, "resistant" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc resistant", ch );
			return;
		}
		if ( !argument || argument[0] == '\0' )
		{
			progbug( "MpMset: no resistant", ch );
			return;
		}
		while ( argument[0] != '\0' )
		{
			argument = one_argument( argument, arg3 );
			value = get_risflag( arg3 );
			if ( value < 0 || value > 31 )
				progbug( "MpMset: Invalid resistant", ch );
			else
				TOGGLE_BIT( victim->resistant, 1 << value );
		}
		return;
	}

	if ( !str_cmp( arg2, "immune" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc immune", ch );
			return;
		}
		if ( !argument || argument[0] == '\0' )
		{
			progbug( "MpMset: no immune", ch );
			return;
		}
		while ( argument[0] != '\0' )
		{
			argument = one_argument( argument, arg3 );
			value = get_risflag( arg3 );
			if ( value < 0 || value > 31 )
				progbug( "MpMset: Invalid immune", ch );
			else
				TOGGLE_BIT( victim->immune, 1 << value );
		}
		return;
	}

	if ( !str_cmp( arg2, "susceptible" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc susceptible", ch );
			return;
		}
		if ( !argument || argument[0] == '\0' )
		{
			progbug( "MpMset: no susceptible", ch );
			return;
		}
		while ( argument[0] != '\0' )
		{
			argument = one_argument( argument, arg3 );
			value = get_risflag( arg3 );
			if ( value < 0 || value > 31 )
				progbug( "MpMset: Invalid susceptible", ch );
			else
				TOGGLE_BIT( victim->susceptible, 1 << value );
		}
		return;
	}

	if ( !str_cmp( arg2, "part" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc part", ch );
			return;
		}
		if ( !argument || argument[0] == '\0' )
		{
			progbug( "MpMset: no part", ch );
			return;
		}
		while ( argument[0] != '\0' )
		{
			argument = one_argument( argument, arg3 );
			value = get_partflag( arg3 );
			if ( value < 0 || value > 31 )
				progbug( "MpMset: Invalid part", ch );
			else
				TOGGLE_BIT( victim->xflags, 1 << value );
		}
		return;
	}

	if ( !str_cmp( arg2, "attack" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc attack", ch );
			return;
		}
		if ( !argument || argument[0] == '\0' )
		{
			progbug( "MpMset: no attack", ch );
			return;
		}
		while ( argument[0] != '\0' )
		{
			argument = one_argument( argument, arg3 );
			value = get_attackflag( arg3 );
			if ( value < 0 )
				progbug( "MpMset: Invalid attack", ch );
			else
				xTOGGLE_BIT( victim->attacks, value );
		}
		return;
	}

	if ( !str_cmp( arg2, "defense" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc defense", ch );
			return;
		}
		if ( !argument || argument[0] == '\0' )
		{
			progbug( "MpMset: no defense", ch );
			return;
		}
		while ( argument[0] != '\0' )
		{
			argument = one_argument( argument, arg3 );
			value = get_defenseflag( arg3 );
			if ( value < 0 || value >= MAX_BITS )
				progbug( "MpMset: Invalid defense", ch );
			else
				xTOGGLE_BIT( victim->defenses, value );
		}
		return;
	}

	if ( !str_cmp( arg2, "pos" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc pos", ch );
			return;
		}
		if ( value < 0 || value > POS_STANDING )
		{
			progbug( "MpMset: Invalid pos", ch );
			return;
		}
		victim->position = value;
		return;
	}

	if ( !str_cmp( arg2, "defpos" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc defpos", ch );
			return;
		}
		if ( value < 0 || value > POS_STANDING )
		{
			progbug( "MpMset: Invalid defpos", ch );
			return;
		}
		victim->defposition = value;
		return;
	}

	if ( !str_cmp( arg2, "speaks" ) )
	{
		if ( !argument || argument[0] == '\0' )
		{
			progbug( "MpMset: no speaks", ch );
			return;
		}
		while ( argument[0] != '\0' )
		{
			argument = one_argument( argument, arg3 );
			value = get_langflag( arg3 );
			v2 = get_langnum( arg3 );
			if ( value == LANG_UNKNOWN )
				progbug( "MpMset: Invalid speaks", ch );
			else if ( !IS_NPC( victim ) )
			{
				if ( !( value &= VALID_LANGS ) )
				{
					progbug( "MpMset: Invalid player language", ch );
					continue;
				}
				if ( v2 == -1 )
					ch_printf( ch, "Unknown language: %s\r\n", arg3 );
				else
					TOGGLE_BIT( victim->speaks, 1 << v2 );
			}
			else
			{
				if ( v2 == -1 )
					ch_printf( ch, "Unknown language: %s\r\n", arg3 );
				else
					TOGGLE_BIT( victim->speaks, 1 << v2 );
			}
		}
		if ( !IS_NPC( victim ) )
		{
			REMOVE_BIT( victim->speaks, race_table[victim->race]->language );
			if ( !knows_language( victim, victim->speaking, victim ) )
				victim->speaking = race_table[victim->race]->language;
		}
		return;
	}

	if ( !str_cmp( arg2, "speaking" ) )
	{
		if ( !IS_NPC( victim ) )
		{
			progbug( "MpMset: can't set pc speaking", ch );
			return;
		}
		if ( !argument || argument[0] == '\0' )
		{
			progbug( "MpMset: no speaking", ch );
			return;
		}
		while ( argument[0] != '\0' )
		{
			argument = one_argument( argument, arg3 );
			value = get_langflag( arg3 );
			if ( value == LANG_UNKNOWN )
				progbug( "MpMset: Invalid speaking", ch );
			else
			{
				v2 = get_langnum( arg3 );
				if ( v2 == -1 )
					ch_printf( ch, "Unknown language: %s\r\n", arg3 );
				else
					TOGGLE_BIT( victim->speaks, 1 << v2 );
			}
		}
		return;
	}

	progbug( "MpMset: Invalid field", ch );
	return;
}
	EditorTranslationImportDialog(EditorTranslationImportPlugin *p_plugin) {

		plugin=p_plugin;


		set_title("Import Translation");

		VBoxContainer *vbc = memnew( VBoxContainer );
		add_child(vbc);
		set_child_rect(vbc);



		VBoxContainer *csvb = memnew( VBoxContainer );

		HBoxContainer *hbc = memnew( HBoxContainer );
		csvb->add_child(hbc);
		vbc->add_margin_child("Source CSV:",csvb);

		import_path = memnew( LineEdit );
		import_path->set_h_size_flags(SIZE_EXPAND_FILL);
		hbc->add_child(import_path);
		ignore_first = memnew( CheckButton );
		ignore_first->set_text("Ignore First Row");
		csvb->add_child(ignore_first);

		Button * import_choose = memnew( Button );
		import_choose->set_text(" .. ");
		hbc->add_child(import_choose);

		import_choose->connect("pressed", this,"_browse");

		VBoxContainer *tcomp = memnew( VBoxContainer);
		hbc = memnew( HBoxContainer );
		tcomp->add_child(hbc);
		vbc->add_margin_child("Target Path:",tcomp);

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

		Button * save_choose = memnew( Button );
		save_choose->set_text(" .. ");
		hbc->add_child(save_choose);

		save_choose->connect("pressed", this,"_browse_target");

		compress = memnew( CheckButton);
		compress->set_pressed(true);
		compress->set_text("Compress");
		tcomp->add_child(compress);

		add_to_project = memnew( CheckButton);
		add_to_project->set_pressed(true);
		add_to_project->set_text("Add to Project (engine.cfg)");
		tcomp->add_child(add_to_project);

		file_select = memnew(EditorFileDialog);
		file_select->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
		add_child(file_select);
		file_select->set_mode(EditorFileDialog::MODE_OPEN_FILE);
		file_select->connect("file_selected", this,"_choose_file");
		file_select->add_filter("*.csv ; Translation CSV");
		save_select = memnew(	EditorDirDialog );
		add_child(save_select);

	//	save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR);
		save_select->connect("dir_selected", this,"_choose_save_dir");

		get_ok()->connect("pressed", this,"_import");
		get_ok()->set_text("Import");


		error_dialog = memnew ( ConfirmationDialog );
		add_child(error_dialog);
		error_dialog->get_ok()->set_text("Accept");
	//	error_dialog->get_cancel()->hide();

		set_hide_on_ok(false);

		columns = memnew( Tree );
		vbc->add_margin_child("Import Languages:",columns,true);
	}
Esempio n. 12
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);
	}
}
Esempio n. 13
0
static gboolean
_show_location_dialog(GtkMenuItem *menuitem, WebApplet *webapplet)
{
  GtkWidget *dialog, *entry, *hbox, *vbox, *home_img, *home_box;
  gint response;

  /* Make the dialog */
  dialog = gtk_dialog_new_with_buttons(_("Open Location"),
                                       GTK_WINDOW(webapplet->mainwindow),
                                       GTK_DIALOG_DESTROY_WITH_PARENT,
                                       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                       GTK_STOCK_OPEN, GTK_RESPONSE_OK,
                                       NULL);
  webapplet->location_dialog = dialog;

  /* Entry and "URL:" label */
  entry = gtk_entry_new();
  g_signal_connect(G_OBJECT(entry), "activate",
                   G_CALLBACK(_send_dialog_response), dialog);

  hbox = gtk_hbox_new(FALSE, 6);
  gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new(_("URL:")), FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 0);

  /* Checkbox: Set as _home page, with nice little Home icon */
  home_img = gtk_image_new_from_stock(GTK_STOCK_HOME, GTK_ICON_SIZE_MENU);
  webapplet->check_home = gtk_check_button_new_with_mnemonic(_("Set as new _Home Page"));

  home_box = gtk_hbox_new(FALSE, 3);
  gtk_box_pack_start(GTK_BOX(home_box), home_img, FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(home_box), webapplet->check_home, FALSE, FALSE, 0);

  /* Put everything together */
  vbox = gtk_vbox_new(FALSE, 6);
  gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(vbox), website_buttons(webapplet), FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(vbox), home_box, FALSE, FALSE, 0);
  gtk_container_set_border_width(GTK_CONTAINER(vbox), 6);
  gtk_widget_show_all(vbox);

  gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), vbox, TRUE, TRUE, 0);

  response = gtk_dialog_run(GTK_DIALOG(dialog));

  if (response == GTK_RESPONSE_OK)
  {
    gchar *url = (gchar*)gtk_entry_get_text(GTK_ENTRY(entry));

    /* Open the page */
    go_to_url(webapplet, url);

    set_title(webapplet, url);

    /* User entered a URL, didn't choose a site */
    awn_applet_simple_set_icon_name(AWN_APPLET_SIMPLE(webapplet->applet),
                                    ICON_NAME);
    config_set_site(webapplet, "");
  }

  gtk_widget_destroy(dialog);

  return TRUE;
}
Esempio n. 14
0
EditorSettingsDialog::EditorSettingsDialog() {

	set_title(TTR("Editor Settings"));

	tabs = memnew( TabContainer );
	add_child(tabs);
	set_child_rect(tabs);

	VBoxContainer *vbc = memnew( VBoxContainer );
	tabs->add_child(vbc);
	vbc->set_name(TTR("General"));

	HBoxContainer *hbc = memnew( HBoxContainer );
	hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	vbc->add_child(hbc);

	Label *l = memnew( Label );
	l->set_text(TTR("Search:")+" ");
	hbc->add_child(l);

	search_box = memnew( LineEdit );
	search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	hbc->add_child(search_box);

	clear_button = memnew( ToolButton );
	hbc->add_child(clear_button);
	clear_button->connect("pressed",this,"_clear_search_box");

	property_editor = memnew( SectionedPropertyEditor );
	//property_editor->hide_top_label();
	property_editor->get_property_editor()->set_use_filter(true);
	property_editor->get_property_editor()->register_text_enter(search_box);
	property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
	vbc->add_child(property_editor);
	property_editor->get_property_editor()->connect("property_edited", this, "_settings_property_edited");

	vbc = memnew( VBoxContainer );
	tabs->add_child(vbc);
	vbc->set_name(TTR("Shortcuts"));

	hbc = memnew( HBoxContainer );
	hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	vbc->add_child(hbc);

	l = memnew( Label );
	l->set_text(TTR("Search:")+" ");
	hbc->add_child(l);

	shortcut_search_box = memnew( LineEdit );
	shortcut_search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	hbc->add_child(shortcut_search_box);
	shortcut_search_box->connect("text_changed", this, "_filter_shortcuts");

	shortcut_clear_button = memnew( ToolButton );
	hbc->add_child(shortcut_clear_button);
	shortcut_clear_button->connect("pressed",this,"_clear_shortcut_search_box");

	shortcuts = memnew( Tree );
	vbc->add_margin_child("Shortcut List:",shortcuts,true);
	shortcuts->set_columns(2);
	shortcuts->set_hide_root(true);
	//shortcuts->set_hide_folding(true);
	shortcuts->set_column_titles_visible(true);
	shortcuts->set_column_title(0,"Name");
	shortcuts->set_column_title(1,"Binding");
	shortcuts->connect("button_pressed",this,"_shortcut_button_pressed");

	press_a_key = memnew( ConfirmationDialog );
	press_a_key->set_focus_mode(FOCUS_ALL);
	add_child(press_a_key);

	l = memnew( Label );
	l->set_text(TTR("Press a Key.."));
	l->set_area_as_parent_rect();
	l->set_align(Label::ALIGN_CENTER);
	l->set_margin(MARGIN_TOP,20);
	l->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_BEGIN,30);
	press_a_key_label=l;
	press_a_key->add_child(l);
	press_a_key->connect("input_event",this,"_wait_for_key");
	press_a_key->connect("confirmed",this,"_press_a_key_confirm");
	//Button *load = memnew( Button );

	//load->set_text("Load..");
	//hbc->add_child(load);


	//get_ok()->set_text("Apply");
	set_hide_on_ok(true);
	//get_cancel()->set_text("Close");

	timer = memnew( Timer );
	timer->set_wait_time(1.5);
	timer->connect("timeout",this,"_settings_save");
	timer->set_one_shot(true);
	add_child(timer);
	EditorSettings::get_singleton()->connect("settings_changed",this,"_settings_changed");
	get_ok()->set_text(TTR("Close"));

	updating=false;

}
Esempio n. 15
0
/*!
 \brief load_rt_text_pf() is called to load up the runtime text configurations
 from the file specified in the firmware's interrogation profile, and populate
 a new window with the runtiem vars text value box.
 */
G_MODULE_EXPORT void load_rt_text_pf(void)
{
	GtkWidget *treeview = NULL; 
	GtkWidget *window = NULL;
	GtkWidget *parent = NULL;
	gint x = 0;
	gint y = 0;
	GtkListStore *store = NULL;
	gchar *filename = NULL;
	GladeXML *main_xml = NULL;
	GladeXML *xml = NULL;
	gboolean xml_result = FALSE;
	CmdLineArgs *args = DATA_GET(global_data,"args");
	xmlDoc *doc = NULL;
	xmlNode *root_element = NULL;
	Firmware_Details *firmware = NULL;

	firmware = DATA_GET(global_data,"firmware");

	if (!(DATA_GET(global_data,"interrogated")))
		return;
	if (!firmware->rtt_map_file)
	{
		dbg_func(CRITICAL,g_strdup_printf(__FILE__": firmware->rtt_map_file is UNDEFINED,\n\texiting runtime text window creation routine!!!!\n"));
		return;
	}

	main_xml = (GladeXML *)DATA_GET(global_data,"main_xml");
	if ((!main_xml) || (DATA_GET(global_data,"leaving")))
		return;

	if (!DATA_GET(global_data,"rtvars_loaded"))
	{
		dbg_func(CRITICAL,g_strdup(__FILE__": load_rt_text_pf()\n\tCRITICAL ERROR, Realtime Variable definitions NOT LOADED!!!\n\n"));
		return;
	}
	gdk_threads_enter();
	set_title(g_strdup(_("Loading RT Text...")));

	filename = get_file(g_build_path(PSEP,RTTEXT_DATA_DIR,firmware->rtt_map_file,NULL),g_strdup("xml"));
	if (!filename)
	{
		dbg_func(RTMLOADER|CRITICAL,g_strdup_printf(__FILE__": load_rt_text_pf()\n\t File \"%s.xml\" not found!!, exiting function\n",firmware->rtt_map_file));
		set_title(g_strdup(_("ERROR RunTimeText Map XML file DOES NOT EXIST!!!")));
		gdk_threads_leave();
		return; 
	}

	/* Create window */
	xml = glade_xml_new(main_xml->filename,"rtt_window",NULL);
	window = glade_xml_get_widget(xml,"rtt_window");
	register_widget("rtt_window",window);
	x = (GINT)DATA_GET(global_data,"rtt_x_origin");
	y = (GINT)DATA_GET(global_data,"rtt_y_origin");
	gtk_window_move(GTK_WINDOW(window),x,y);
	gtk_window_set_default_size(GTK_WINDOW(window),-1,-1);
	g_object_set(window, "resizable", TRUE, NULL);
	parent = glade_xml_get_widget(xml,"rtt_vbox");
	glade_xml_signal_autoconnect(xml);

	LIBXML_TEST_VERSION

		doc = xmlReadFile(filename, NULL, 0);
	g_free(filename);
	if (doc == NULL)
	{
		printf(_("error: could not parse file %s\n"),filename);
		gdk_threads_leave();
		return;
	}

	/*Get the root element node */
	store = gtk_list_store_new(RTT_NUM_COLS,G_TYPE_POINTER,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_FLOAT);
	DATA_SET(global_data,"rtt_model",store);
	treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
	gtk_box_pack_start(GTK_BOX(parent),treeview,TRUE,TRUE,0);
	setup_rtt_treeview(treeview);

	root_element = xmlDocGetRootElement(doc);
	xml_result = load_rtt_xml_elements(root_element,store,parent);
	xmlFreeDoc(doc);
	xmlCleanupParser();

	if (xml_result == FALSE)
		gtk_widget_destroy(window);
	else if ((!args->hide_rttext) && (xml_result))
		gtk_widget_show_all(window);

	set_title(g_strdup(_("RT Text Loaded...")));
	gdk_threads_leave();
	return;
}
Esempio n. 16
0
const char* odf_average(const char* out_name,std::vector<std::string>& file_names)
{
    static std::string error_msg,report;
    tessellated_icosahedron ti;
    float vs[3];
    image::basic_image<unsigned char,3> mask;
    std::vector<std::vector<float> > odfs;
    unsigned int half_vertex_count = 0;
    unsigned int row,col;
    float mni[16]={0};
    begin_prog("averaging");
    for (unsigned int index = 0;check_prog(index,file_names.size());++index)
    {
        const char* file_name = file_names[index].c_str();
        gz_mat_read reader;
        set_title(file_names[index].c_str());
        if(!reader.load_from_file(file_name))
        {
            error_msg = "Cannot open file ";
            error_msg += file_name;
            check_prog(0,0);
            return error_msg.c_str();
        }
        if(index == 0)
        {
            {
                const char* report_buf = 0;
                if(reader.read("report",row,col,report_buf))
                    report = std::string(report_buf,report_buf+row*col);
            }
            const float* odf_buffer;
            const short* face_buffer;
            const unsigned short* dimension;
            const float* vs_ptr;
            const float* fa0;
            const float* mni_ptr;
            unsigned int face_num,odf_num;
            error_msg = "";
            if(!reader.read("dimension",row,col,dimension))
                error_msg = "dimension";
            if(!reader.read("fa0",row,col,fa0))
                error_msg = "fa0";
            if(!reader.read("voxel_size",row,col,vs_ptr))
                error_msg = "voxel_size";
            if(!reader.read("odf_faces",row,face_num,face_buffer))
                error_msg = "odf_faces";
            if(!reader.read("odf_vertices",row,odf_num,odf_buffer))
                error_msg = "odf_vertices";
            if(!reader.read("trans",row,col,mni_ptr))
                error_msg = "trans";
            if(error_msg.length())
            {
                error_msg += " missing in ";
                error_msg += file_name;
                check_prog(0,0);
                return error_msg.c_str();
            }
            mask.resize(image::geometry<3>(dimension));
            for(unsigned int index = 0;index < mask.size();++index)
                if(fa0[index] != 0.0)
                    mask[index] = 1;
            std::copy(vs_ptr,vs_ptr+3,vs);
            ti.init(odf_num,odf_buffer,face_num,face_buffer);
            half_vertex_count = odf_num >> 1;
            std::copy(mni_ptr,mni_ptr+16,mni);
        }
        else
        // check odf consistency
        {
Esempio n. 17
0
GroupDialog::GroupDialog() {

	scene_tree = SceneTree::get_singleton();

	VBoxContainer *vbc = memnew(VBoxContainer);
	add_child(vbc);

	HBoxContainer *hbc = memnew(HBoxContainer);
	vbc->add_child(hbc);
	hbc->set_v_size_flags(SIZE_EXPAND_FILL);

	VBoxContainer *vbc_left = memnew(VBoxContainer);
	hbc->add_child(vbc_left);
	vbc_left->set_h_size_flags(SIZE_EXPAND_FILL);

	Label *group_title = memnew(Label);
	group_title->set_text(TTR("Groups"));
	vbc_left->add_child(group_title);

	groups = memnew(Tree);
	vbc_left->add_child(groups);
	groups->set_hide_root(true);
	groups->set_v_size_flags(SIZE_EXPAND_FILL);
	groups->set_select_mode(Tree::SELECT_SINGLE);
	groups->set_allow_reselect(true);
	groups->set_allow_rmb_select(true);
	groups->connect("item_selected", this, "_group_selected");
	groups->connect("button_pressed", this, "_delete_group_pressed");
	groups->connect("item_edited", this, "_group_renamed");

	HBoxContainer *chbc = memnew(HBoxContainer);
	vbc_left->add_child(chbc);
	chbc->set_h_size_flags(SIZE_EXPAND_FILL);

	add_group_text = memnew(LineEdit);
	chbc->add_child(add_group_text);
	add_group_text->set_h_size_flags(SIZE_EXPAND_FILL);

	Button *add_group_button = memnew(Button);
	add_group_button->set_text("Add");
	chbc->add_child(add_group_button);
	add_group_button->connect("pressed", this, "_add_group_pressed");

	VBoxContainer *vbc_add = memnew(VBoxContainer);
	hbc->add_child(vbc_add);
	vbc_add->set_h_size_flags(SIZE_EXPAND_FILL);

	Label *out_of_group_title = memnew(Label);
	out_of_group_title->set_text(TTR("Nodes not in Group"));
	vbc_add->add_child(out_of_group_title);

	nodes_to_add = memnew(Tree);
	vbc_add->add_child(nodes_to_add);
	nodes_to_add->set_hide_root(true);
	nodes_to_add->set_hide_folding(true);
	nodes_to_add->set_v_size_flags(SIZE_EXPAND_FILL);
	nodes_to_add->set_select_mode(Tree::SELECT_MULTI);
	nodes_to_add->connect("item_selected", this, "_nodes_to_add_selected");

	HBoxContainer *add_filter_hbc = memnew(HBoxContainer);
	add_filter_hbc->add_constant_override("separate", 0);
	vbc_add->add_child(add_filter_hbc);

	add_filter = memnew(LineEdit);
	add_filter->set_h_size_flags(SIZE_EXPAND_FILL);
	add_filter->set_placeholder(TTR("Filter nodes"));
	add_filter_hbc->add_child(add_filter);
	add_filter->connect("text_changed", this, "_add_filter_changed");

	VBoxContainer *vbc_buttons = memnew(VBoxContainer);
	hbc->add_child(vbc_buttons);
	vbc_buttons->set_h_size_flags(SIZE_SHRINK_CENTER);
	vbc_buttons->set_v_size_flags(SIZE_SHRINK_CENTER);

	add_button = memnew(ToolButton);
	add_button->set_text(TTR("Add"));
	add_button->connect("pressed", this, "_add_pressed");

	vbc_buttons->add_child(add_button);
	vbc_buttons->add_spacer();
	vbc_buttons->add_spacer();
	vbc_buttons->add_spacer();

	remove_button = memnew(ToolButton);
	remove_button->set_text(TTR("Remove"));
	remove_button->connect("pressed", this, "_removed_pressed");

	vbc_buttons->add_child(remove_button);

	VBoxContainer *vbc_remove = memnew(VBoxContainer);
	hbc->add_child(vbc_remove);
	vbc_remove->set_h_size_flags(SIZE_EXPAND_FILL);

	Label *in_group_title = memnew(Label);
	in_group_title->set_text(TTR("Nodes in Group"));
	vbc_remove->add_child(in_group_title);

	nodes_to_remove = memnew(Tree);
	vbc_remove->add_child(nodes_to_remove);
	nodes_to_remove->set_v_size_flags(SIZE_EXPAND_FILL);
	nodes_to_remove->set_hide_root(true);
	nodes_to_remove->set_hide_folding(true);
	nodes_to_remove->set_select_mode(Tree::SELECT_MULTI);
	nodes_to_remove->connect("item_selected", this, "_node_to_remove_selected");

	HBoxContainer *remove_filter_hbc = memnew(HBoxContainer);
	remove_filter_hbc->add_constant_override("separate", 0);
	vbc_remove->add_child(remove_filter_hbc);

	remove_filter = memnew(LineEdit);
	remove_filter->set_h_size_flags(SIZE_EXPAND_FILL);
	remove_filter->set_placeholder(TTR("Filter nodes"));
	remove_filter_hbc->add_child(remove_filter);
	remove_filter->connect("text_changed", this, "_remove_filter_changed");

	set_title("Group Editor");
	get_cancel()->hide();
	set_as_toplevel(true);

	error = memnew(ConfirmationDialog);
	add_child(error);
	error->get_ok()->set_text(TTR("Close"));
}
ExampleWindow::ExampleWindow()
: m_VBox(Gtk::ORIENTATION_VERTICAL, 6),
  m_Button_Quit(Gtk::Stock::QUIT),
  m_Button_Clear("Clear")
{
  set_title("Gtk::InfoBar example");
  set_border_width(6);
  set_default_size(400, 200);

  add(m_VBox);

  // Add the message label to the InfoBar:
  Gtk::Container* infoBarContainer =
    dynamic_cast<Gtk::Container*>(m_InfoBar.get_content_area());
  if (infoBarContainer)
    infoBarContainer->add(m_Message_Label);

  // Add an ok button to the InfoBar:
  m_InfoBar.add_button(Gtk::Stock::OK, 0);

  // Add the InfoBar to the vbox:
  m_VBox.pack_start(m_InfoBar, Gtk::PACK_SHRINK);

  // Create the buffer and set it for the TextView:
  m_refTextBuffer = Gtk::TextBuffer::create();
  m_TextView.set_buffer(m_refTextBuffer);

  // Add the TreeView, inside a ScrolledWindow:
  m_ScrolledWindow.add(m_TextView);

  // Show the scrollbars only when they are necessary:
  m_ScrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);

  m_VBox.pack_start(m_ScrolledWindow);

  // Add button box:
  m_VBox.pack_start(m_ButtonBox, Gtk::PACK_SHRINK);

  m_ButtonBox.pack_start(m_Button_Clear, Gtk::PACK_SHRINK);
  m_ButtonBox.pack_start(m_Button_Quit, Gtk::PACK_SHRINK);
  m_ButtonBox.set_spacing(6);
  m_ButtonBox.set_layout(Gtk::BUTTONBOX_END);

  // Connect signals:
  m_InfoBar.signal_response().connect(sigc::mem_fun(*this,
              &ExampleWindow::on_infobar_response) );
  m_Button_Quit.signal_clicked().connect(sigc::mem_fun(*this,
              &ExampleWindow::on_button_quit) );
  m_Button_Clear.signal_clicked().connect(sigc::mem_fun(*this,
              &ExampleWindow::on_button_clear) );
  m_refTextBuffer->signal_changed().connect(sigc::mem_fun(*this,
              &ExampleWindow::on_textbuffer_changed) );

  show_all_children();

  // Keep the InfoBar hidden until a message needs to be shown:
  m_InfoBar.hide();

  // Make the clear button insensitive until text is typed in the buffer.  When
  // the button is sensitive and it is pressed, the InfoBar is displayed with a
  // message.
  m_Button_Clear.set_sensitive(false);
}
MESignPostInfoDialog::MESignPostInfoDialog(
      OldConnection* conn, uint32 toNodeID, MEMapArea* mapArea)
{

   m_connection = conn;
   m_toNodeID = toNodeID;
   m_mapArea = mapArea;
   m_editSpDialog = NULL;

   char tmpStr[256];
   sprintf( tmpStr, "%s, 0x%x",
            "Sign post info", m_mapArea->getMap()->getMapID() );
   set_title(tmpStr);
   
   // list with all sign posts for this connection
   Gtk::Frame* frame = manage(new Gtk::Frame("Signposts:"));

   // Create ListStore and add to TreeView
   m_listStore = Gtk::ListStore::create(m_columns);
   m_treeView.set_model(m_listStore);

   // Add visible columns to TreeView
   m_treeView.append_column("REMOVE ME", m_columns.m_info);
   m_treeView.set_headers_visible(false);

   // Create selection object to handle selections
   m_selection = m_treeView.get_selection();
   if(!m_selection)
   { 
      // If this doesn't work we're in trouble.
      mc2log << error << "No selection object created for corresponding "
             << "TreeView" << endl;
      MC2_ASSERT(false);
   }


   Gtk::ScrolledWindow* scrolledWin = manage(new Gtk::ScrolledWindow());
   scrolledWin->set_size_request(200, 150);
   scrolledWin->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
   scrolledWin->add(m_treeView);
   frame->add(*scrolledWin);
   get_vbox()->pack_start(*frame, true, true, 5);

   // buttons for Edit and Close in the action area
   Gtk::HBox* actionBox = manage(new Gtk::HBox());
   if (m_mapArea != NULL) {
      Gtk::Button* editButton = manage(new Gtk::Button("Edit"));
      editButton->set_size_request(75, 25);
      editButton->signal_clicked().connect(
            sigc::mem_fun(*this, &MESignPostInfoDialog::editSpPressed));
      actionBox->pack_start(*editButton);
   } else {
      // empty label..
      Gtk::Label* editLabel = manage(new Gtk::Label(""));
      editLabel->set_size_request(75, 25);
      actionBox->pack_start(*editLabel);
   }
   Gtk::Button* closeButton = manage(new Gtk::Button("Close"));
   closeButton->signal_clicked().connect(
                  sigc::mem_fun(*this, &MESignPostInfoDialog::closePressed));
   closeButton->set_size_request(75, 25);
   actionBox->pack_start(*closeButton);
   get_action_area()->pack_start(*actionBox);

   // Don't show the dialog now, wait for show()-command.
}
Esempio n. 20
0
void Ge::activate_preview_start()
{
    graph->init_trace();
    set_title();
}
Esempio n. 21
0
	EditorSampleImportDialog(EditorSampleImportPlugin *p_plugin) {

		plugin=p_plugin;


		set_title("Import Audio Samples");

		VBoxContainer *vbc = memnew( VBoxContainer );
		add_child(vbc);
		set_child_rect(vbc);


		HBoxContainer *hbc = memnew( HBoxContainer );
		vbc->add_margin_child("Source Sample(s):",hbc);

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

		Button * import_choose = memnew( Button );
		import_choose->set_text(" .. ");
		hbc->add_child(import_choose);

		import_choose->connect("pressed", this,"_browse");

		hbc = memnew( HBoxContainer );
		vbc->add_margin_child("Target Path:",hbc);

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

		Button * save_choose = memnew( Button );
		save_choose->set_text(" .. ");
		hbc->add_child(save_choose);

		save_choose->connect("pressed", this,"_browse_target");

		file_select = memnew(EditorFileDialog);
		file_select->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
		add_child(file_select);
		file_select->set_mode(EditorFileDialog::MODE_OPEN_FILES);
		file_select->connect("files_selected", this,"_choose_files");
		file_select->add_filter("*.wav ; MS Waveform");
		save_select = memnew(	EditorDirDialog );
		add_child(save_select);

	//	save_select->set_mode(EditorFileDialog::MODE_OPEN_DIR);
		save_select->connect("dir_selected", this,"_choose_save_dir");

		get_ok()->connect("pressed", this,"_import");
		get_ok()->set_text("Import");


		error_dialog = memnew ( ConfirmationDialog );
		add_child(error_dialog);
		error_dialog->get_ok()->set_text("Accept");
	//	error_dialog->get_cancel()->hide();

		set_hide_on_ok(false);
		options = memnew( _EditorSampleImportOptions );

		option_editor = memnew( PropertyEditor );
		option_editor->hide_top_label();
		vbc->add_margin_child("Options:",option_editor,true);
	}
Esempio n. 22
0
void Ge::activate_preview_stop()
{
    graph->close_trace( 1);
    set_title();
}
Esempio n. 23
0
ScriptCreateDialog::ScriptCreateDialog() {

	/* SNAP DIALOG */

	VBoxContainer *vb = memnew( VBoxContainer );
	add_child(vb);
	set_child_rect(vb);


	class_name = memnew( LineEdit );
	VBoxContainer *vb2 = memnew( VBoxContainer );
	vb2->add_child(class_name);
	class_name->connect("text_changed", this,"_class_name_changed");
	error_label = memnew(Label);
	error_label->set_text("valid chars: a-z A-Z 0-9 _");
	error_label->set_align(Label::ALIGN_CENTER);
	vb2->add_child(error_label);
	vb->add_margin_child(TTR("Class Name:"),vb2);

	parent_name = memnew( LineEdit );
	vb->add_margin_child(TTR("Inherits:"),parent_name);
	parent_name->connect("text_changed", this,"_class_name_changed");

	language_menu = memnew( OptionButton );
	vb->add_margin_child(TTR("Language"),language_menu);

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

		language_menu->add_item(ScriptServer::get_language(i)->get_name());
	}

	editor_settings = EditorSettings::get_singleton();
	String last_selected_language = editor_settings->get_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);
				break;
			}
	else language_menu->select(0);

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

	//parent_name->set_text();

	vb2 = memnew( VBoxContainer );
	path_vb = memnew( VBoxContainer );
	vb2->add_child(path_vb);

	HBoxContainer *hbc = memnew( HBoxContainer );
	file_path = memnew( LineEdit );
	file_path->connect("text_changed",this,"_path_changed");
	hbc->add_child(file_path);
	file_path->set_h_size_flags(SIZE_EXPAND_FILL);
	Button *b = memnew( Button );
	b->set_text(" .. ");
	b->connect("pressed",this,"_browse_path");
	hbc->add_child(b);
	path_vb->add_child(hbc);
	path_error_label = memnew( Label );
	path_vb->add_child( path_error_label );
	path_error_label->set_text(TTR("Error!"));
	path_error_label->set_align(Label::ALIGN_CENTER);


	internal = memnew( CheckButton );
	internal->set_text(TTR("Built-In Script"));
	vb2->add_child(internal);
	internal->connect("pressed",this,"_built_in_pressed");

	vb->add_margin_child(TTR("Path:"),vb2);

	set_size(Size2(200,150));
	set_hide_on_ok(false);
	set_title(TTR("Attach Node Script"));

	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 );
	add_child(alert);
	_lang_changed(0);

	create_new=true;
}
Esempio n. 24
0
EXPORT void ready_msg_pf(void)
{
	gdk_threads_enter();
	set_title(g_strdup(_("Ready...")));
	gdk_threads_leave();
}
Esempio n. 25
0
GSteg::GSteg() : gsteg_box(Gtk::ORIENTATION_VERTICAL)
{
    //Default gubbins:
    set_title("GSteg");
    set_default_size(500, 500);
    add(gsteg_box); 
  
    //Define the actions:
    gsteg_ag = Gio::SimpleActionGroup::create();
  
    gsteg_ag->add_action("open",    sigc::mem_fun(*this, &GSteg::on_action_file_open));
    gsteg_ag->add_action("quit",    sigc::mem_fun(*this, &GSteg::on_action_file_quit));
    gsteg_ag->add_action("encode",  sigc::mem_fun(*this, &GSteg::on_action_encode));
    gsteg_ag->add_action("decode",  sigc::mem_fun(*this, &GSteg::on_action_decode));
    gsteg_ag->add_action("about",   sigc::mem_fun(*this, &GSteg::on_action_help_about));
  
    insert_action_group("gsteg", gsteg_ag);

    this->add_events(Gdk::KEY_PRESS_MASK);
    this->signal_key_release_event().connect(sigc::mem_fun(*this, &GSteg::on_key_release));

    //Create and allocate the builder:
    Glib::RefPtr<Gtk::Builder> gsteg_ui = Gtk::Builder::create();
    Glib::ustring ui_info = 
    "<interface>"
        "<menu id='gsteg_menu'>"
            "<submenu>"
                "<attribute name='label' translatable='yes'>_File</attribute>"
                    "<section>"
                        "<item>"
                            "<attribute name='label' translatable='yes'>_Open</attribute>"
                            "<attribute name='action'>gsteg.open</attribute>"
                            "<attribute name='accel'>&lt;Primary&gt;o</attribute>"
                        "</item>"
                   "</section>"
                   "<section>"
                        "<item>"
                            "<attribute name='label' translatable='yes'>_Quit</attribute>"
                            "<attribute name='action'>gsteg.quit</attribute>"
                            "<attribute name='accel'>&lt;Primary&gt;q</attribute>"
                        "</item>"
                    "</section>"
            "</submenu>"
            "<submenu>"
                "<attribute name='label' translatable='yes'>_Encode</attribute>"
                    "<section>"
                        "<item>"
                            "<attribute name='label' translatable='yes'>_Encode</attribute>"
                            "<attribute name='action'>gsteg.encode</attribute>"
                            "<attribute name='accel'>&lt;Primary&gt;e</attribute>"
                        "</item>"
                    "</section>"
            "</submenu>"
            "<submenu>"
                "<attribute name='label' translatable='yes'>_Decode</attribute>"
                    "<section>"
                        "<item>"
                            "<attribute name='label' translatable='yes'>_Decode</attribute>"
                            "<attribute name='action'>gsteg.decode</attribute>"
                            "<attribute name='accel'>&lt;Primary&gt;d</attribute>"
                        "</item>"
                    "</section>"
            "</submenu>"
            "<submenu>"
                "<attribute name='label' translatable='yes'>_Help</attribute>"
                    "<item>"
                        "<attribute name='label' translatable='yes'>_About</attribute>"
                        "<attribute name='action'>gsteg.about</attribute>"
                        "<attribute name='accel'>F1</attribute>"
                    "</item>"
            "</submenu>"
    "</menu>";
    try
    {
        gsteg_ui->add_from_string(ui_info);
    }
    catch(const Glib::Error& ex)
    {
        msgBox("Unable to load UI", "The UI string is invalid. Correct and try again.", "UI Error", Gtk::MESSAGE_ERROR);
    }

    //Get the menubar:
    Glib::RefPtr<Gio::Menu> gmenu = Glib::RefPtr<Gio::Menu>::cast_dynamic(gsteg_ui->get_object("gsteg_menu"));
  
    if(!gmenu)
    {
        msgBox("Unable to load menu from UI", "Unable to read the menu, or the menu failed to initialize.", "UI Error", Gtk::MESSAGE_ERROR);
    } 

    gsteg_menu = new Gtk::MenuBar(gmenu);
  
    //Create and add empty image to window:
    gsteg_image = Gtk::manage(new Gtk::Image());

    //Create and allocate txt_in:
    gsteg_txt_in = Gtk::manage(new Gtk::TextView());
    gsteg_txt_in->set_wrap_mode(Gtk::WRAP_CHAR);
    gsteg_txt_in->set_buffer(gsteg_txt_buf);

    //Create the ScrolledWindow to stop TextView auto-resizing:
    gsteg_txt_no_scroll = Gtk::manage(new Gtk::ScrolledWindow());
    gsteg_txt_no_scroll->add(*gsteg_txt_in);

    //Create the ScrolledWindow to stop Image auto-resizing:
    gsteg_img_no_scroll = Gtk::manage(new Gtk::ScrolledWindow());
    gsteg_img_no_scroll->add(*gsteg_image);

    //AboutDialog gubbins:
    gsteg_about.set_logo_icon_name("help-about");
    gsteg_about.set_program_name("GSteg");
    gsteg_about.set_version("1.0");
    gsteg_about.set_copyright("Ellis Kenyo");
    gsteg_about.set_comments("GSteg is an application for embedding text within an image.");
    gsteg_about.set_license_type(Gtk::LICENSE_BSD);
    gsteg_about.set_website("http://www.elken.github.io/GSteg");

    //Add widgets to the window:
    gsteg_box.pack_start(*gsteg_menu, Gtk::PACK_SHRINK);
    gsteg_box.pack_start(*gsteg_img_no_scroll, true, true);
    gsteg_box.pack_start(*gsteg_txt_no_scroll, true, true);

    show_all_children();
}
EditorFileDialog::EditorFileDialog() {

	show_hidden_files=default_show_hidden_files;
	display_mode=default_display_mode;
	local_history_pos=0;

	VBoxContainer *vbc = memnew( VBoxContainer );
	add_child(vbc);
	set_child_rect(vbc);

	mode=MODE_SAVE_FILE;
	set_title(TTR("Save a File"));

	HBoxContainer *pathhb = memnew( HBoxContainer );

	dir_prev = memnew( ToolButton );
	dir_next = memnew( ToolButton );
	dir_up = memnew( ToolButton );

	pathhb->add_child(dir_prev);
	pathhb->add_child(dir_next);
	pathhb->add_child(dir_up);

	dir_prev->connect("pressed",this,"_go_back");
	dir_next->connect("pressed",this,"_go_forward");
	dir_up->connect("pressed",this,"_go_up");

	dir = memnew(LineEdit);
	pathhb->add_child(dir);
	dir->set_h_size_flags(SIZE_EXPAND_FILL);

	refresh = memnew( ToolButton );
	refresh->connect("pressed",this,"_update_file_list");
	pathhb->add_child(refresh);

	favorite = memnew( ToolButton );
	favorite->set_toggle_mode(true);
	favorite->connect("toggled",this,"_favorite_toggled");
	pathhb->add_child(favorite);

	mode_thumbnails = memnew( ToolButton );
	mode_thumbnails->connect("pressed",this,"set_display_mode",varray(DISPLAY_THUMBNAILS));
	mode_thumbnails->set_toggle_mode(true);
	mode_thumbnails->set_pressed(display_mode==DISPLAY_THUMBNAILS);
	pathhb->add_child(mode_thumbnails);

	mode_list = memnew( ToolButton );
	mode_list->connect("pressed",this,"set_display_mode",varray(DISPLAY_LIST));
	mode_list->set_toggle_mode(true);
	mode_list->set_pressed(display_mode==DISPLAY_LIST);
	pathhb->add_child(mode_list);

	drives = memnew( OptionButton );
	pathhb->add_child(drives);
	drives->connect("item_selected",this,"_select_drive");

	makedir = memnew( Button );
	makedir->set_text(TTR("Create Folder"));
	makedir->connect("pressed",this,"_make_dir");
	pathhb->add_child(makedir);

	list_hb = memnew( HBoxContainer );

	vbc->add_margin_child(TTR("Path:"),pathhb);
	vbc->add_child(list_hb);
	list_hb->set_v_size_flags(SIZE_EXPAND_FILL);

	VBoxContainer *fav_vb = memnew( VBoxContainer );
	list_hb->add_child(fav_vb);
	HBoxContainer *fav_hb = memnew( HBoxContainer );
	fav_vb->add_child(fav_hb);
	fav_hb->add_child(memnew(Label(TTR("Favorites:"))));
	fav_hb->add_spacer();
	fav_up = memnew( ToolButton );
	fav_hb->add_child(fav_up);
	fav_up->connect("pressed",this,"_favorite_move_up");
	fav_down = memnew( ToolButton );
	fav_hb->add_child(fav_down);
	fav_down->connect("pressed",this,"_favorite_move_down");
	fav_rm = memnew( ToolButton );
	fav_hb->add_child(fav_rm);
	fav_rm->hide(); // redundant

	MarginContainer *fav_mv = memnew( MarginContainer );
	fav_vb->add_child(fav_mv);
	fav_mv->set_v_size_flags(SIZE_EXPAND_FILL);
	favorites = memnew( ItemList );
	fav_mv->add_child(favorites);
	favorites->connect("item_selected",this,"_favorite_selected");

	recent = memnew( ItemList );
	fav_vb->add_margin_child(TTR("Recent:"),recent,true);
	recent->connect("item_selected",this,"_recent_selected");

	VBoxContainer *item_vb = memnew( VBoxContainer );
	list_hb->add_child(item_vb);
	item_vb->set_h_size_flags(SIZE_EXPAND_FILL);

	item_list = memnew( ItemList );
	item_list->set_v_size_flags(SIZE_EXPAND_FILL);
	item_vb->add_margin_child(TTR("Directories & Files:"),item_list,true);

	HBoxContainer* filter_hb = memnew( HBoxContainer );
	item_vb->add_child(filter_hb);

	VBoxContainer *filter_vb = memnew( VBoxContainer );
	filter_hb->add_child(filter_vb);
	filter_vb->set_h_size_flags(SIZE_EXPAND_FILL);

	preview_vb = memnew( VBoxContainer );
	filter_hb->add_child(preview_vb);
	CenterContainer *prev_cc = memnew( CenterContainer );
	preview_vb->add_margin_child(TTR("Preview:"),prev_cc);
	preview = memnew( TextureFrame );
	prev_cc->add_child(preview);
	preview_vb->hide();


	file = memnew(LineEdit);
	//add_child(file);
	filter_vb->add_margin_child(TTR("File:"),file);


	filter = memnew( OptionButton );
	//add_child(filter);
	filter_vb->add_margin_child(TTR("Filter:"),filter);
	filter->set_clip_text(true);//too many extensions overflow it

	dir_access = DirAccess::create(DirAccess::ACCESS_RESOURCES);
	access=ACCESS_RESOURCES;
	_update_drives();


	connect("confirmed", this,"_action_pressed");
	//cancel->connect("pressed", this,"_cancel_pressed");
	item_list->connect("item_selected", this,"_item_selected",varray(),CONNECT_DEFERRED);
	item_list->connect("item_activated", this,"_item_db_selected",varray());
	dir->connect("text_entered", this,"_dir_entered");
	file->connect("text_entered", this,"_file_entered");
	filter->connect("item_selected", this,"_filter_selected");


	confirm_save = memnew( ConfirmationDialog );
	confirm_save->set_as_toplevel(true);
	add_child(confirm_save);


	confirm_save->connect("confirmed", this,"_save_confirm_pressed");

	makedialog = memnew( ConfirmationDialog );
	makedialog->set_title(TTR("Create Folder"));
	VBoxContainer *makevb= memnew( VBoxContainer );
	makedialog->add_child(makevb);
	makedialog->set_child_rect(makevb);
	makedirname = memnew( LineEdit );
	makevb->add_margin_child(TTR("Name:"),makedirname);
	add_child(makedialog);
	makedialog->register_text_enter(makedirname);
	makedialog->connect("confirmed",this,"_make_dir_confirm");
	mkdirerr = memnew( AcceptDialog );
	mkdirerr->set_text(TTR("Could not create folder."));
	add_child(mkdirerr);

	exterr = memnew( AcceptDialog );
	exterr->set_text(TTR("Must use a valid extension."));
	add_child(exterr);


	//update_file_list();
	update_filters();
	update_dir();

	set_hide_on_ok(false);
	vbox=vbc;


	invalidated=true;
	if (register_func)
		register_func(this);

	preview_wheel_timeout=0;
	preview_wheel_index=0;
	preview_waiting=false;

}
Esempio n. 27
0
ProjectSettings::ProjectSettings(EditorData *p_data) {


	singleton=this;
	set_title("Project Settings (engine.cfg)");
	undo_redo=&p_data->get_undo_redo();
	data=p_data;


	TabContainer *tab_container = memnew( TabContainer );
	add_child(tab_container);
	set_child_rect(tab_container);

	//tab_container->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN, 15 );
	//tab_container->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END, 15 );
	//tab_container->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN, 15 );
	//tab_container->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 );

	Control *props_base = memnew( Control );
	tab_container->add_child(props_base);
	props_base->set_name("General");
	globals_editor = memnew( PropertyEditor );
	props_base->add_child(globals_editor);
	globals_editor->set_area_as_parent_rect();
	globals_editor->hide_top_label();
	globals_editor->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN, 55 );
	globals_editor->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 );
	globals_editor->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN, 5 );
	globals_editor->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END, 5 );
	globals_editor->set_capitalize_paths(false);
	globals_editor->get_tree()->connect("cell_selected",this,"_item_selected");
	globals_editor->connect("property_toggled",this,"_item_checked");
	globals_editor->connect("property_edited",this,"_settings_prop_edited");


	Label *l = memnew( Label );
	props_base->add_child(l);
	l->set_pos(Point2(6,5));
	l->set_text("Category:");


	l = memnew( Label );
	l->set_anchor(MARGIN_LEFT,ANCHOR_RATIO);
	props_base->add_child(l);
	l->set_begin(Point2(0.21,5));
	l->set_text("Property:");

	l = memnew( Label );
	l->set_anchor(MARGIN_LEFT,ANCHOR_RATIO);
	props_base->add_child(l);
	l->set_begin(Point2(0.51,5));
	l->set_text("Type:");

	category = memnew( LineEdit );
	props_base->add_child(category);
	category->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO);
	category->set_begin( Point2(5,25) );
	category->set_end( Point2(0.20,26) );
	category->connect("text_entered",this,"_item_adds");

	property = memnew( LineEdit );
	props_base->add_child(property);
	property->set_anchor(MARGIN_LEFT,ANCHOR_RATIO);
	property->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO);
	property->set_begin( Point2(0.21,25) );
	property->set_end( Point2(0.50,26) );
	property->connect("text_entered",this,"_item_adds");


	type = memnew( OptionButton );
	props_base->add_child(type);
	type->set_anchor(MARGIN_LEFT,ANCHOR_RATIO);
	type->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO);
	type->set_begin( Point2(0.51,25) );
	type->set_end( Point2(0.70,26) );
	type->add_item("bool");
	type->add_item("int");
	type->add_item("float");
	type->add_item("string");

	Button *add = memnew( Button );
	props_base->add_child(add);
	add->set_anchor(MARGIN_LEFT,ANCHOR_RATIO);
	add->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO);
	add->set_begin( Point2(0.71,25) );
	add->set_end( Point2(0.85,26) );
	add->set_text("Add");
	add->connect("pressed",this,"_item_add");

	Button *del = memnew( Button );
	props_base->add_child(del);
	del->set_anchor(MARGIN_LEFT,ANCHOR_RATIO);
	del->set_anchor(MARGIN_RIGHT,ANCHOR_END);
	del->set_begin( Point2(0.86,25) );
	del->set_end( Point2(5,26) );
	del->set_text("Del");
	del->connect("pressed",this,"_item_del");

	Button *save = memnew( Button );
	props_base->add_child(save);
	save->set_anchor(MARGIN_LEFT,ANCHOR_END);
	save->set_anchor(MARGIN_RIGHT,ANCHOR_END);
	save->set_anchor(MARGIN_TOP,ANCHOR_END);
	save->set_anchor(MARGIN_BOTTOM,ANCHOR_END);
	save->set_begin( Point2(80,28) );
	save->set_end( Point2(10,20) );
	save->set_text("Save");
	save->connect("pressed",this,"_save");

	popup_platform = memnew( MenuButton );
	popup_platform->set_text("Copy To Platform..");
	popup_platform->set_disabled(true);
	props_base->add_child(popup_platform);

	popup_platform->set_anchor(MARGIN_LEFT,ANCHOR_BEGIN);
	popup_platform->set_anchor(MARGIN_RIGHT,ANCHOR_BEGIN);
	popup_platform->set_anchor(MARGIN_TOP,ANCHOR_END);
	popup_platform->set_anchor(MARGIN_BOTTOM,ANCHOR_END);
	popup_platform->set_begin( Point2(10,28) );
	popup_platform->set_end( Point2(150,20) );

	List<StringName> ep;
	EditorImportExport::get_singleton()->get_export_platforms(&ep);
	ep.sort_custom<StringName::AlphCompare>();

	for(List<StringName>::Element *E=ep.front();E;E=E->next()) {

		popup_platform->get_popup()->add_item( E->get() );

	}

	popup_platform->get_popup()->connect("item_pressed",this,"_copy_to_platform");
	get_ok()->set_text("Close");
	set_hide_on_ok(true);

	message = memnew( ConfirmationDialog );
	add_child(message);
//	message->get_cancel()->hide();
	message->set_hide_on_ok(true);

	Control *input_base = memnew( Control );
	input_base->set_name("Input Map");
	input_base->set_area_as_parent_rect();;
	tab_container->add_child(input_base);

	l = memnew( Label );
	input_base->add_child(l);
	l->set_pos(Point2(6,5));
	l->set_text("Action:");

	action_name = memnew( LineEdit );
	action_name->set_anchor(MARGIN_RIGHT,ANCHOR_RATIO);
	action_name->set_begin( Point2(5,25) );
	action_name->set_end( Point2(0.85,26) );
	input_base->add_child(action_name);
	action_name->connect("text_entered",this,"_action_adds");

	add = memnew( Button );
	input_base->add_child(add);
	add->set_anchor(MARGIN_LEFT,ANCHOR_RATIO);
	add->set_begin( Point2(0.86,25) );
	add->set_anchor(MARGIN_RIGHT,ANCHOR_END);
	add->set_end( Point2(5,26) );
	add->set_text("Add");
	add->connect("pressed",this,"_action_add");

	input_editor = memnew( Tree );
	input_base->add_child(input_editor);
	input_editor->set_area_as_parent_rect();
	input_editor->set_anchor_and_margin(MARGIN_TOP,ANCHOR_BEGIN, 55 );
	input_editor->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 );
	input_editor->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN, 5 );
	input_editor->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END, 5 );
	input_editor->connect("item_edited",this,"_action_persist_toggle");
	input_editor->connect("button_pressed",this,"_action_button_pressed");
	popup_add = memnew( PopupMenu );
	add_child(popup_add);
	popup_add->connect("item_pressed",this,"_add_item");

	press_a_key = memnew( ConfirmationDialog );
	press_a_key->set_focus_mode(FOCUS_ALL);
	add_child(press_a_key);



	l = memnew( Label );
	l->set_text("Press a Key..");
	l->set_area_as_parent_rect();
	l->set_align(Label::ALIGN_CENTER);
	l->set_margin(MARGIN_TOP,20);
	l->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_BEGIN,30);
	press_a_key_label=l;
	press_a_key->add_child(l);
	press_a_key->connect("input_event",this,"_wait_for_key");
	press_a_key->connect("confirmed",this,"_press_a_key_confirm");


	device_input=memnew( ConfirmationDialog );
	add_child(device_input);
	device_input->get_ok()->set_text("Add");
	device_input->connect("confirmed",this,"_device_input_add");

	l = memnew( Label );
	l->set_text("Device:");
	l->set_pos(Point2(15,10));
	device_input->add_child(l);

	l = memnew( Label );
	l->set_text("Index:");
	l->set_pos(Point2(90,10));
	device_input->add_child(l);
	device_index_label=l;

	device_id = memnew( SpinBox );
	device_id->set_pos(Point2(20,30));
	device_id->set_size(Size2(70,10));
	device_id->set_val(0);

	device_input->add_child(device_id);

	device_index = memnew( OptionButton );
	device_index->set_pos(Point2(95,30));
	device_index->set_size(Size2(300,10));
	device_index->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,10);

	device_input->add_child(device_index);

	save = memnew( Button );
	input_base->add_child(save);
	save->set_anchor(MARGIN_LEFT,ANCHOR_END);
	save->set_anchor(MARGIN_RIGHT,ANCHOR_END);
	save->set_anchor(MARGIN_TOP,ANCHOR_END);
	save->set_anchor(MARGIN_BOTTOM,ANCHOR_END);
	save->set_begin( Point2(80,28) );
	save->set_end( Point2(10,20) );
	save->set_text("Save");
	save->connect("pressed",this,"_save");

	setting=false;

	//translations
	TabContainer *translations = memnew( TabContainer );
	translations->set_name("Localization");
	tab_container->add_child(translations);

	{

		VBoxContainer *tvb = memnew( VBoxContainer );
		translations->add_child(tvb);
		tvb->set_name("Translations");
		HBoxContainer *thb = memnew( HBoxContainer);
		tvb->add_child(thb);
		thb->add_child( memnew( Label("Translations:")));
		thb->add_spacer();
		Button *addtr = memnew( Button("Add..") );
		addtr->connect("pressed",this,"_translation_file_open");
		thb->add_child(addtr);
		MarginContainer *tmc = memnew( MarginContainer );
		tvb->add_child(tmc);
		tmc->set_v_size_flags(SIZE_EXPAND_FILL);
		translation_list = memnew( Tree );
		translation_list->set_v_size_flags(SIZE_EXPAND_FILL);
		tmc->add_child(translation_list);

		translation_file_open=memnew( FileDialog );
		add_child(translation_file_open);
		translation_file_open->set_mode(FileDialog::MODE_OPEN_FILE);
		translation_file_open->connect("file_selected",this,"_translation_add");

	}

	{
		VBoxContainer *tvb = memnew( VBoxContainer );
		translations->add_child(tvb);
		tvb->set_name("Remaps");
		HBoxContainer *thb = memnew( HBoxContainer);
		tvb->add_child(thb);
		thb->add_child( memnew( Label("Resources:")));
		thb->add_spacer();
		Button *addtr = memnew( Button("Add..") );
		addtr->connect("pressed",this,"_translation_res_file_open");
		thb->add_child(addtr);
		MarginContainer *tmc = memnew( MarginContainer );
		tvb->add_child(tmc);
		tmc->set_v_size_flags(SIZE_EXPAND_FILL);
		translation_remap = memnew( Tree );
		translation_remap->set_v_size_flags(SIZE_EXPAND_FILL);
		translation_remap->connect("cell_selected",this,"_translation_res_select");
		tmc->add_child(translation_remap);
		translation_remap->connect("button_pressed",this,"_translation_res_delete");

		translation_res_file_open=memnew( FileDialog );
		add_child(translation_res_file_open);
		translation_res_file_open->set_mode(FileDialog::MODE_OPEN_FILE);
		translation_res_file_open->connect("file_selected",this,"_translation_res_add");

		thb = memnew( HBoxContainer);
		tvb->add_child(thb);
		thb->add_child( memnew( Label("Remaps by Locale:")));
		thb->add_spacer();
		addtr = memnew( Button("Add..") );
		addtr->connect("pressed",this,"_translation_res_option_file_open");
		translation_res_option_add_button=addtr;
		thb->add_child(addtr);
		tmc = memnew( MarginContainer );
		tvb->add_child(tmc);
		tmc->set_v_size_flags(SIZE_EXPAND_FILL);
		translation_remap_options = memnew( Tree );
		translation_remap_options->set_v_size_flags(SIZE_EXPAND_FILL);
		tmc->add_child(translation_remap_options);

		translation_remap_options->set_columns(2);
		translation_remap_options->set_column_title(0,"Path");
		translation_remap_options->set_column_title(1,"Locale");
		translation_remap_options->set_column_titles_visible(true);
		translation_remap_options->set_column_expand(0,true);
		translation_remap_options->set_column_expand(1,false);
		translation_remap_options->set_column_min_width(1,200);
		translation_remap_options->connect("item_edited",this,"_translation_res_option_changed");
		translation_remap_options->connect("button_pressed",this,"_translation_res_option_delete");

		translation_res_option_file_open=memnew( FileDialog );
		add_child(translation_res_option_file_open);
		translation_res_option_file_open->set_mode(FileDialog::MODE_OPEN_FILE);
		translation_res_option_file_open->connect("file_selected",this,"_translation_res_option_add");

	}


	{
		VBoxContainer *avb = memnew( VBoxContainer );
		tab_container->add_child(avb);
		avb->set_name("AutoLoad");
		HBoxContainer *ahb = memnew( HBoxContainer);
		avb->add_child(ahb);

		VBoxContainer *avb_name = memnew( VBoxContainer );
		avb_name->set_h_size_flags(SIZE_EXPAND_FILL);
		autoload_add_name = memnew(LineEdit);
		avb_name->add_margin_child("Node Name:",autoload_add_name);
		ahb->add_child(avb_name);

		VBoxContainer *avb_path = memnew( VBoxContainer );
		avb_path->set_h_size_flags(SIZE_EXPAND_FILL);
		HBoxContainer *ahb_path = memnew( HBoxContainer );
		autoload_add_path = memnew(LineEdit);
		autoload_add_path->set_h_size_flags(SIZE_EXPAND_FILL);
		ahb_path->add_child(autoload_add_path);
		Button *browseaa = memnew( Button("..") );
		ahb_path->add_child(browseaa);
		browseaa->connect("pressed",this,"_autoload_file_open");
		Button *addaa = memnew( Button("Add") );
		ahb_path->add_child(addaa);
		addaa->connect("pressed",this,"_autoload_add");

		avb_path->add_margin_child("Path:",ahb_path);
		ahb->add_child(avb_path);

		autoload_list = memnew( Tree );
		autoload_list->set_v_size_flags(SIZE_EXPAND_FILL);
		avb->add_margin_child("List:",autoload_list,true);

		autoload_file_open=memnew( FileDialog );
		add_child(autoload_file_open);
		autoload_file_open->set_mode(FileDialog::MODE_OPEN_FILE);
		autoload_file_open->connect("file_selected",this,"_autoload_file_callback");

		autoload_list->set_columns(2);
		autoload_list->set_column_titles_visible(true);
		autoload_list->set_column_title(0,"name");
		autoload_list->set_column_title(1,"path");
		autoload_list->connect("button_pressed",this,"_autoload_delete");

	}

	timer = memnew( Timer );
	timer->set_wait_time(1.5);
	timer->connect("timeout",Globals::get_singleton(),"save");
	timer->set_one_shot(true);
	add_child(timer);

	updating_translations=false;


	/*
	Control * es = memnew( Control );
	es->set_name("Export");
	tab_container->add_child(es);
	export_settings = memnew( ProjectExportSettings );
	es->add_child(export_settings);
	export_settings->set_area_as_parent_rect();
	export_settings->set_anchor_and_margin(MARGIN_BOTTOM,ANCHOR_END, 35 );
*/
}
Esempio n. 28
0
EditorAbout::EditorAbout() {

	set_title(TTR("Thanks from the Godot community!"));
	get_ok()->set_text(TTR("Thanks!"));
	set_hide_on_ok(true);
	set_resizable(true);

	VBoxContainer *vbc = memnew(VBoxContainer);
	HBoxContainer *hbc = memnew(HBoxContainer);
	hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	hbc->set_alignment(BoxContainer::ALIGN_CENTER);
	hbc->add_constant_override("separation", 30 * EDSCALE);
	add_child(vbc);
	vbc->add_child(hbc);

	_logo = memnew(TextureRect);
	hbc->add_child(_logo);

	String hash = String(VERSION_HASH);
	if (hash.length() != 0)
		hash = "." + hash.left(7);

	Label *about_text = memnew(Label);
	about_text->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
	about_text->set_text(VERSION_FULL_NAME + hash + String::utf8("\n\u00A9 2007-2017 Juan Linietsky, Ariel Manzur.\n\u00A9 2014-2017 ") +
						 TTR("Godot Engine contributors") + "\n");
	hbc->add_child(about_text);

	TabContainer *tc = memnew(TabContainer);
	tc->set_custom_minimum_size(Size2(630, 240) * EDSCALE);
	tc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
	vbc->add_child(tc);

	// Authors

	List<String> dev_sections;
	dev_sections.push_back(TTR("Project Founders"));
	dev_sections.push_back(TTR("Lead Developer"));
	dev_sections.push_back(TTR("Project Manager"));
	dev_sections.push_back(TTR("Developers"));
	const char **dev_src[] = { dev_founders, dev_lead, dev_manager, dev_names };
	tc->add_child(_populate_list(TTR("Authors"), dev_sections, dev_src));

	// Donors

	List<String> donor_sections;
	donor_sections.push_back(TTR("Platinum Sponsors"));
	donor_sections.push_back(TTR("Gold Sponsors"));
	donor_sections.push_back(TTR("Mini Sponsors"));
	donor_sections.push_back(TTR("Gold Donors"));
	donor_sections.push_back(TTR("Silver Donors"));
	donor_sections.push_back(TTR("Bronze Donors"));
	const char **donor_src[] = { donor_s_plat, donor_s_gold, donor_s_mini, donor_gold, donor_silver, donor_bronze };
	tc->add_child(_populate_list(TTR("Donors"), donor_sections, donor_src));

	// License

	TextEdit *license = memnew(TextEdit);
	license->set_name(TTR("License"));
	license->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	license->set_v_size_flags(Control::SIZE_EXPAND_FILL);
	license->set_wrap(true);
	license->set_readonly(true);
	license->set_text(String::utf8(about_license));
	tc->add_child(license);

	// Thirdparty License

	VBoxContainer *license_thirdparty = memnew(VBoxContainer);
	license_thirdparty->set_name(TTR("Thirdparty License"));
	license_thirdparty->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	tc->add_child(license_thirdparty);

	Label *tpl_label = memnew(Label);
	tpl_label->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	tpl_label->set_autowrap(true);
	tpl_label->set_text(TTR("Godot Engine relies on a number of thirdparty free and open source libraries, all compatible with the terms of its MIT license. The following is an exhaustive list of all such thirdparty components with their respective copyright statements and license terms."));
	license_thirdparty->add_child(tpl_label);

	HSplitContainer *tpl_hbc = memnew(HSplitContainer);
	tpl_hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	tpl_hbc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
	tpl_hbc->set_split_offset(240 * EDSCALE);
	license_thirdparty->add_child(tpl_hbc);

	_tpl_tree = memnew(Tree);
	_tpl_tree->set_hide_root(true);
	TreeItem *root = _tpl_tree->create_item();
	TreeItem *tpl_ti_all = _tpl_tree->create_item(root);
	tpl_ti_all->set_text(0, TTR("All Components"));
	TreeItem *tpl_ti_tp = _tpl_tree->create_item(root);
	tpl_ti_tp->set_text(0, TTR("Components"));
	tpl_ti_tp->set_selectable(0, false);
	TreeItem *tpl_ti_lc = _tpl_tree->create_item(root);
	tpl_ti_lc->set_text(0, TTR("Licenses"));
	tpl_ti_lc->set_selectable(0, false);
	int read_idx = 0;
	String long_text = "";
	for (int i = 0; i < THIRDPARTY_COUNT; i++) {

		TreeItem *ti = _tpl_tree->create_item(tpl_ti_tp);
		String thirdparty = String(about_thirdparty[i]);
		ti->set_text(0, thirdparty);
		String text = thirdparty + "\n";
		long_text += "- " + thirdparty + "\n\n";
		for (int j = 0; j < about_tp_copyright_count[i]; j++) {

			text += "\n    Files:\n        " + String(about_tp_file[read_idx]).replace("\n", "\n        ") + "\n";
			String copyright = String::utf8("    \u00A9 ") + String::utf8(about_tp_copyright[read_idx]).replace("\n", String::utf8("\n    \u00A9 "));
			text += copyright;
			long_text += copyright;
			String license = "\n    License: " + String(about_tp_license[read_idx]) + "\n";
			text += license;
			long_text += license + "\n";
			read_idx++;
		}
		ti->set_metadata(0, text);
	}
	for (int i = 0; i < LICENSE_COUNT; i++) {

		TreeItem *ti = _tpl_tree->create_item(tpl_ti_lc);
		String licensename = String(about_license_name[i]);
		ti->set_text(0, licensename);
		long_text += "- " + licensename + "\n\n";
		String licensebody = String(about_license_body[i]);
		ti->set_metadata(0, licensebody);
		long_text += "    " + licensebody.replace("\n", "\n    ") + "\n\n";
	}
	tpl_ti_all->set_metadata(0, long_text);
	tpl_hbc->add_child(_tpl_tree);

	_tpl_text = memnew(TextEdit);
	_tpl_text->set_h_size_flags(Control::SIZE_EXPAND_FILL);
	_tpl_text->set_v_size_flags(Control::SIZE_EXPAND_FILL);
	_tpl_text->set_wrap(true);
	_tpl_text->set_readonly(true);
	tpl_hbc->add_child(_tpl_text);

	_tpl_tree->connect("item_selected", this, "_license_tree_selected");
	tpl_ti_all->select(0);
	_tpl_text->set_text(tpl_ti_all->get_metadata(0));
}
Esempio n. 29
0
MainWindow::MainWindow()
{
  set_title("Handle Project");
  set_icon_from_file("images/HaPr_high_80x100_ver2.gif");
  set_size_request(200, 200);
  set_default_size(500, 300);
  set_position(Gtk::WIN_POS_CENTER);
  signal_hide().connect(sigc::mem_fun(*this, &MainWindow::on_action_file_exit));
  Gtk::VBox *const main_box = new Gtk::VBox(false, 0);
  add(*Gtk::manage(main_box));
  create_menu(main_box);
  std::list<Project> active_projects = get_projects_from_db();
  Glib::ustring str_no_proj, str_late_proj, str_history_proj;
  std::stringstream ss, ss2, ss3;
  no_active = active_projects.size();
  ss << no_active;
  ss >> str_no_proj;
  std::list<Project> hist_projects = get_projects_from_db(HISTORY_PROJECT);
  no_history = hist_projects.size();
  ss3 << no_history;
  ss3 >> str_history_proj;
  no_late = 0;
  for(std::list<Project>::iterator it = active_projects.begin(); it != active_projects.end(); it++)
  {
    if(it->is_late())
      no_late++;
  }
  ss2 << no_late;
  ss2 >> str_late_proj;
  
  treeview = new Gtk::TreeView();
  Gtk::manage(treeview);
  scrollview.add(*treeview);
  scrollview.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
  treeviewhist = new Gtk::TreeView();
  Gtk::manage(treeviewhist);
  Gtk::ScrolledWindow *scrollhistory = new Gtk::ScrolledWindow();
  Gtk::manage(scrollhistory);
  scrollhistory->add(*treeviewhist);
  scrollhistory->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
  tabview = new Gtk::Notebook();
  Gtk::manage(tabview);
  tabview->append_page(scrollview, _("_Active projects"), true);
  tabview->append_page(*scrollhistory, _("P_roject history"), true);
  main_box->pack_start(*tabview);

  //Table for active projects.
  Gtk::TreeModel::ColumnRecord *col_record = new Gtk::TreeModel::ColumnRecord();
  col_id = new Gtk::TreeModelColumn<time_t>();
  col_no = new Gtk::TreeModelColumn<std::string>();
  col_name = new Gtk::TreeModelColumn<std::string>();
  col_desc = new Gtk::TreeModelColumn<std::string>();
  col_leader_name = new Gtk::TreeModelColumn<std::string>();
  col_leader_surname = new Gtk::TreeModelColumn<std::string>();
  col_start_date = new Gtk::TreeModelColumn<std::string>();
  col_end_date = new Gtk::TreeModelColumn<std::string>();

  col_record->add(*col_id);
  col_record->add(*col_no);
  col_record->add(*col_name);
  col_record->add(*col_desc);
  col_record->add(*col_leader_name);
  col_record->add(*col_leader_surname);
  col_record->add(*col_start_date);
  col_record->add(*col_end_date);

  ref_tree_model = Gtk::ListStore::create(*col_record);
  treeview->set_model(ref_tree_model);

  int j = 0;
  Gtk::TreeModel::Row row;
  for(std::list<Project>::iterator it = active_projects.begin(); it != active_projects.end(); it++)
  {
    row = *(ref_tree_model->append());
    row[*col_id] = it->get_id();
    row[*col_no] = it->get_project_no();
    row[*col_name] = it->get_project_name();
    row[*col_desc] = it->get_description();
    row[*col_leader_name] = it->get_project_leader_name();
    row[*col_leader_surname] = it->get_project_leader_surname();
    row[*col_start_date] = it->get_start_date_str_eu();
    row[*col_end_date] = it->get_end_date_str_eu();
    j++;
  }

  treeview->append_column(_("Number"), *col_no);
  treeview->append_column(_("Name"), *col_name);
  treeview->append_column(_("Description"), *col_desc);
  treeview->append_column(_("Leader name"), *col_leader_name);
  treeview->append_column(_("Leader surmane"), *col_leader_surname);
  treeview->append_column(_("Start date"), *col_start_date);
  treeview->append_column(_("End date"), *col_end_date);
  treeview->set_headers_clickable(true);
  treeview->set_grid_lines(Gtk::TREE_VIEW_GRID_LINES_BOTH);

  for(int i=0; i < 7; i++)
  {
    Gtk::TreeView::Column *pColumn = treeview->get_column(i);
    pColumn->set_resizable(true);
    pColumn->set_sort_column(i+1);
  }

  //Table for history.
  Gtk::TreeModel::ColumnRecord *col_record_hist = new Gtk::TreeModel::ColumnRecord();
  col_id_hist = new Gtk::TreeModelColumn<time_t>();
  col_no_hist = new Gtk::TreeModelColumn<std::string>();
  col_desc_hist = new Gtk::TreeModelColumn<std::string>();
  col_name_hist = new Gtk::TreeModelColumn<std::string>();
  col_leader_name_hist = new Gtk::TreeModelColumn<std::string>();
  col_leader_surname_hist = new Gtk::TreeModelColumn<std::string>();
  col_start_date_hist = new Gtk::TreeModelColumn<std::string>();
  col_end_date_hist = new Gtk::TreeModelColumn<std::string>();

  col_record_hist->add(*col_id_hist);
  col_record_hist->add(*col_no_hist);
  col_record_hist->add(*col_name_hist);
  col_record_hist->add(*col_desc_hist);
  col_record_hist->add(*col_leader_name_hist);
  col_record_hist->add(*col_leader_surname_hist);
  col_record_hist->add(*col_start_date_hist);
  col_record_hist->add(*col_end_date_hist);

  ref_tree_model_hist = Gtk::ListStore::create(*col_record_hist);
  treeviewhist->set_model(ref_tree_model_hist);

  Gtk::TreeModel::Row row_hist;
  for(std::list<Project>::iterator it = hist_projects.begin(); it != hist_projects.end(); it++)
  {
    row_hist = *(ref_tree_model_hist->append());
    row_hist[*col_id_hist] = it->get_id();
    row_hist[*col_no_hist] = it->get_project_no();
    row_hist[*col_name_hist] = it->get_project_name();
    row_hist[*col_desc_hist] = it->get_description();
    row_hist[*col_leader_name_hist] = it->get_project_leader_name();
    row_hist[*col_leader_surname_hist] = it->get_project_leader_surname();
    row_hist[*col_start_date_hist] = it->get_start_date_str_eu();
    row_hist[*col_end_date_hist] = it->get_end_date_str_eu();
    j++;
  }

  treeviewhist->append_column(_("Number"), *col_no_hist);
  treeviewhist->append_column(_("Name"), *col_name_hist);
  treeviewhist->append_column(_("Description"), *col_desc_hist);
  treeviewhist->append_column(_("Leader name"), *col_leader_name_hist);
  treeviewhist->append_column(_("Leader surmane"), *col_leader_surname_hist);
  treeviewhist->append_column(_("Start date"), *col_start_date_hist);
  treeviewhist->append_column(_("End date"), *col_end_date_hist);
  treeviewhist->set_headers_clickable(true);
  treeviewhist->set_grid_lines(Gtk::TREE_VIEW_GRID_LINES_BOTH);

  for(int i=0; i < 7; i++)
  {
    Gtk::TreeView::Column *pColumn_hist = treeviewhist->get_column(i);
    pColumn_hist->set_resizable(true);
    pColumn_hist->set_sort_column(i+1);
  }

  Gtk::HBox *const status_box = new Gtk::HBox(false, 0);
  Gtk::manage(status_box);
  active_label = new Gtk::Label(_("Number of active projects: ") +  str_no_proj);
  late_label = new Gtk::Label(_("Number of late projects: ") + str_late_proj);
  history_label = new Gtk::Label(_("Number of projects in history: ") + str_history_proj);
  Gtk::manage(active_label);
  Gtk::manage(late_label);
  Gtk::manage(history_label);
  
  status_box->pack_start(*active_label);
  status_box->pack_start(*late_label);
  status_box->pack_start(*history_label);

  main_box->pack_start(*status_box, Gtk::PACK_SHRINK);
  show_all_children();
}
	EditorFontImportDialog(EditorFontImportPlugin *p_plugin) {
		plugin=p_plugin;
		VBoxContainer *vbc = memnew( VBoxContainer );
		add_child(vbc);
		set_child_rect(vbc);
		HBoxContainer *hbc = memnew( HBoxContainer);
		vbc->add_child(hbc);
		VBoxContainer *vbl = memnew( VBoxContainer );
		hbc->add_child(vbl);
		hbc->set_v_size_flags(SIZE_EXPAND_FILL);
		vbl->set_h_size_flags(SIZE_EXPAND_FILL);
		VBoxContainer *vbr = memnew( VBoxContainer );
		hbc->add_child(vbr);
		vbr->set_h_size_flags(SIZE_EXPAND_FILL);

		source = memnew( LineEditFileChooser );
		source->get_file_dialog()->set_access(FileDialog::ACCESS_FILESYSTEM);
		source->get_file_dialog()->set_mode(FileDialog::MODE_OPEN_FILE);
		source->get_file_dialog()->add_filter("*.ttf;TrueType");
		source->get_file_dialog()->add_filter("*.otf;OpenType");
		source->get_line_edit()->connect("text_entered",this,"_src_changed");

		vbl->add_margin_child("Source Font:",source);
		font_size = memnew( SpinBox );
		vbl->add_margin_child("Source Font Size:",font_size);
		font_size->set_min(3);
		font_size->set_max(256);
		font_size->set_val(16);
		font_size->connect("value_changed",this,"_font_size_changed");
		dest = memnew( LineEditFileChooser );
		//
		List<String> fl;
		Ref<Font> font= memnew(Font);
		dest->get_file_dialog()->add_filter("*.fnt ; Font" );
		//ResourceSaver::get_recognized_extensions(font,&fl);
		//for(List<String>::Element *E=fl.front();E;E=E->next()) {
		//	dest->get_file_dialog()->add_filter("*."+E->get());
		//}

		vbl->add_margin_child("Dest Resource:",dest);
		HBoxContainer *testhb = memnew( HBoxContainer );
		test_string = memnew( LineEdit );
		test_string->set_text("The quick brown fox jumps over the lazy dog.");
		test_string->set_h_size_flags(SIZE_EXPAND_FILL);
		test_string->set_stretch_ratio(5);

		testhb->add_child(test_string);
		test_color = memnew( ColorPickerButton );
		test_color->set_color(get_color("font_color","Label"));
		test_color->set_h_size_flags(SIZE_EXPAND_FILL);
		test_color->set_stretch_ratio(1);
		test_color->connect("color_changed",this,"_update_text3");
		testhb->add_child(test_color);

		vbl->add_spacer();
		vbl->add_margin_child("Test: ",testhb);
		HBoxContainer *upd_hb = memnew( HBoxContainer );
//		vbl->add_child(upd_hb);
		upd_hb->add_spacer();
		Button *update = memnew( Button);
		upd_hb->add_child(update);
		update->set_text("Update");
		update->connect("pressed",this,"_update");

		options = memnew( _EditorFontImportOptions );
		prop_edit = memnew( PropertyEditor() );
		vbr->add_margin_child("Options:",prop_edit,true);
		options->connect("changed",this,"_prop_changed");

		prop_edit->hide_top_label();

		Panel *panel = memnew( Panel );
		vbc->add_child(panel);
		test_label = memnew( Label );
		test_label->set_autowrap(true);
		panel->add_child(test_label);
		test_label->set_area_as_parent_rect();
		panel->set_v_size_flags(SIZE_EXPAND_FILL);
		test_string->connect("text_changed",this,"_update_text2");
		set_title("Font Import");
		timer = memnew( Timer );
		add_child(timer);
		timer->connect("timeout",this,"_update");
		timer->set_wait_time(0.4);
		timer->set_one_shot(true);

		get_ok()->connect("pressed", this,"_import");
		get_ok()->set_text("Import");

		error_dialog = memnew ( ConfirmationDialog );
		add_child(error_dialog);
		error_dialog->get_ok()->set_text("Accept");
		set_hide_on_ok(false);


	}