//////////////////////////////////////////////////
// Constructor
AddToProjectDialog::AddToProjectDialog(FXWindow* owner, const FXString& title)
:	FXDialogBox(owner, title, DECOR_ALL),
		tgtFile(file),
		tgtProject(project),
		tgtDir(dir),
		tgtFiletype(filetype)
{
	FXVerticalFrame *frm = new FXVerticalFrame(this, LAYOUT_FILL_X|LAYOUT_FILL_Y);
	new DialogTitle(frm, "Add file to project?");

	FXHorizontalFrame *hfrm;

	// Filename
	hfrm = new FXHorizontalFrame(frm, LAYOUT_FILL_X);
	new FXLabel(hfrm, "Filename:");
	new FXTextField(hfrm, 15, &tgtFile, FXDataTarget::ID_VALUE, TEXTFIELD_NORMAL|TEXTFIELD_READONLY);

	// Project
	hfrm = new FXHorizontalFrame(frm, LAYOUT_FILL_X);
	new FXLabel(hfrm, "Project:");
	combo = new FXComboBox(hfrm, 15, &tgtProject, FXDataTarget::ID_VALUE, COMBOBOX_STATIC|FRAME_NORMAL);

	// get MainWindow
	FXWindow *mainWindow = getOwner();
	while (!dynamic_cast<MainWindow*>(mainWindow))
		mainWindow = mainWindow->getOwner();
	mw = dynamic_cast<MainWindow*>(mainWindow);

	// fill ComboBox
	for (int i = 0; i < mw->projects.no(); ++i)
		combo->appendItem(mw->projects[i]->getProjectName());

	// directory and filetype
	hfrm = new FXHorizontalFrame(frm, LAYOUT_FILL_X);

	FXGroupBox *gp = new FXGroupBox(hfrm, "Directory", FRAME_LINE);
	FXVerticalFrame *vfrm = new FXVerticalFrame(gp, LAYOUT_FILL_X|LAYOUT_FILL_Y);
	new FXRadioButton(vfrm, "src", 			&tgtDir, FXDataTarget::ID_OPTION+0);
	new FXRadioButton(vfrm, "include", 		&tgtDir, FXDataTarget::ID_OPTION+1);
	new FXRadioButton(vfrm, "doc", 			&tgtDir, FXDataTarget::ID_OPTION+2);
	new FXRadioButton(vfrm, "ressource",	&tgtDir, FXDataTarget::ID_OPTION+3);
	new FXRadioButton(vfrm, "project root",	&tgtDir, FXDataTarget::ID_OPTION+4);

	gp = new FXGroupBox(hfrm, "Filetype", FRAME_LINE);
	vfrm = new FXVerticalFrame(gp, LAYOUT_FILL_X|LAYOUT_FILL_Y);
	new FXRadioButton(vfrm, "C++ Source", 		&tgtFiletype, FXDataTarget::ID_OPTION+0);
	new FXRadioButton(vfrm, "C++ Header", 		&tgtFiletype, FXDataTarget::ID_OPTION+1);
	new FXRadioButton(vfrm, "Textfile", 		&tgtFiletype, FXDataTarget::ID_OPTION+2);
	new FXRadioButton(vfrm, "Ressource file",	&tgtFiletype, FXDataTarget::ID_OPTION+3);

	// Buttons
	hfrm = new FXHorizontalFrame(frm, LAYOUT_FILL_X);
	new FXButton(hfrm, "&Cancel", NULL, this, FXDialogBox::ID_CANCEL, BUTTON_DEFAULT|LAYOUT_LEFT|FRAME_RAISED|FRAME_THICK, 0, 0, 0, 0, 12, 12, 4, 4);	
	new FXButton(hfrm, "&Ok", NULL, this, FXDialogBox::ID_ACCEPT, BUTTON_INITIAL|BUTTON_DEFAULT|LAYOUT_RIGHT|FRAME_RAISED|FRAME_THICK, 0, 0, 0, 0, 12, 12, 4, 4);	
}