Пример #1
0
int CFREDDoc::autosave(char *desc)
{
	int i;
	CFred_mission_save save;
	CWaitCursor wait;

	if (Autosave_disabled)
		return 0;

	if (Briefing_dialog)
		Briefing_dialog->update_data(1);
	
	if (save.autosave_mission_file(MISSION_BACKUP_NAME)) {
		Undo_count = Undo_available = 0;
		return -1;
	}

	for (i=BACKUP_DEPTH; i>1; i--)
		undo_desc[i] = undo_desc[i - 1];

	if (desc)
		undo_desc[1] = desc;
	else
		undo_desc[1].Empty();

	Undo_count++;
	check_undo();
	return 0;
}
Пример #2
0
void Controller::process_after_applying(cv::Mat frame) {

  /** To call after aplying an effect.
    *
    * Add frame if given or the @current_image_to_process member to undo-redo vector.
    * After checking if their are some undo done in case it erase the unneded frame from the vector.
    *
    * Optional @arg: frame -> in case the current_image_to_process member is unsuable.
    *
    *************************************************************************************************/
 
  image_to_display_vector_idx++ ;  // We increment: in case of undo-redo vector erasing it's up-to-date.

  check_undo() ; // Check if undo and erase from the undo-redo vector.

  if (! frame.empty() ) {
    // frame argument given we process.
    image_to_display_vector.push_back(frame.clone()) ;  // Add the last image resulting of the operation.
    current_image_to_process = frame.clone() ;
  }
  else {
    image_to_display_vector.push_back(current_image_to_process.clone()) ;  // Add the last image resulting of the operation.
  }


}
Пример #3
0
int CFREDDoc::autoload() {
	char name[256], backup_name[256];
	int i, r;
	FILE *fp;

	cf_create_default_path_string(name, sizeof(name) - 1, CF_TYPE_MISSIONS);
	strcat_s(name, MISSION_BACKUP_NAME);
	strcpy_s(backup_name, name);
	strcat_s(name, ".002");

	// Check if Backup.002 exists
	fp = fopen(name, "r");
	if (!fp)
		return 0;
	fclose(fp);

	if (Briefing_dialog) {
		// clean things up first
		Briefing_dialog->icon_select(-1);
	}

	// Load Backup.002
	//	editor_init_mission();  
	r = load_mission(name);
	Update_window = 1;

	// Delete Backup.001
	auto len = strlen(backup_name);
	strcat_s(backup_name, ".001");
	cf_delete(backup_name, CF_TYPE_MISSIONS);

	// Rename Backups. .002 becomes .001, .003 becomes .002, etc.
	for (i = 1; i < BACKUP_DEPTH; i++) {
		sprintf(backup_name + len, ".%.3d", i + 1);
		sprintf(name + len, ".%.3d", i);
		cf_rename(backup_name, name, CF_TYPE_MISSIONS);
		undo_desc[i] = undo_desc[i + 1];
	}

	// Reduce the undo count and check if we can do another undo op.
	Undo_count--;
	check_undo();
	return r;
}
Пример #4
0
int CFREDDoc::autoload()
{
	char name[256], backup_name[256];
	int i, r, len;
	FILE *fp;

	strcpy(name, current_dir);
	strcat(name, MISSION_BACKUP_NAME);
	strcat(name, ".002");
	
	//strcpy(name, MISSION_BACKUP_NAME);
	//strcat(name, ".002");

	fp = fopen(name, "r");
	if (!fp)
		return 0;

	fclose(fp);
	if (Briefing_dialog)
		Briefing_dialog->icon_select(-1);  // clean things up first

//	editor_init_mission();  
	r = load_mission(name);
	Update_window = 1;

	strcpy(backup_name, current_dir);
	strcat(backup_name, MISSION_BACKUP_NAME);
	len = strlen(backup_name);
	strcat(backup_name, ".001");
	cf_delete(backup_name, CF_TYPE_MISSIONS);

	for (i=1; i<BACKUP_DEPTH; i++) {
		sprintf(backup_name + len, ".%.3d", i + 1);
		sprintf(name + len, ".%.3d", i);
		cf_rename(backup_name, name, CF_TYPE_MISSIONS);
		undo_desc[i] = undo_desc[i + 1];
	}

	Undo_count--;
	check_undo();
	return r;
}