Exemple #1
0
static void print_logo(void)
{
	const std::ios::fmtflags stateBackup(std::wcout.flags());
	std::wcerr << L"\nINetGet v" << build_version_string() << L" - Lightweight command-line front-end to WinINet\n"
		<< L"Copyright (c) " << &BUILD_DATE[7] << L" LoRd_MuldeR <*****@*****.**>. Some rights reserved.\n"
		<< L"Built on " << BUILD_DATE << L" at " << BUILD_TIME << L", " << BUILD_COMP << L", Win-" << BUILD_ARCH << L", " << BUILD_CONF << L'\n' << std::endl;
	std::wcout.flags(stateBackup);

	const time_t build_time = Utils::decode_date_str(BUILD_DATE);
	if(build_time > 0)
	{
		const time_t now = time(NULL);
		if((now > build_time) && ((now - build_time) >= 31556926i64))
		{
			std::wcerr << L"NOTE: This binary is more than a year old, there probably is a new version.\n" << UPDATE_INFO << std::endl;
		}
	}
}
Exemple #2
0
void
Main_GUI::run()
{
  statusBar()->clearMessage();

  QString input_name = QDir::fromNativeSeparators(input_line->text());
  QString output_name = QDir::fromNativeSeparators(output_line->text());
  if (!check_filenames(input_name, output_name))
    return;

  // we need C file descriptors for communication with TTF_autohint
  FILE* input;
  FILE* output;

again:
  if (!open_files(input_name, &input, output_name, &output))
    return;

  QProgressDialog dialog;
  dialog.setCancelButtonText(tr("Cancel"));
  dialog.setMinimumDuration(1000);
  dialog.setWindowModality(Qt::WindowModal);

  const unsigned char* error_string;
  TA_Info_Func info_func = info;
  GUI_Progress_Data gui_progress_data = {-1, true, &dialog};
  Info_Data info_data;

  info_data.data = NULL; // must be deallocated after use
  info_data.data_wide = NULL; // must be deallocated after use
  info_data.data_len = 0;
  info_data.data_wide_len = 0;

  info_data.hinting_range_min = min_box->value();
  info_data.hinting_range_max = max_box->value();
  info_data.hinting_limit = no_limit_box->isChecked()
                            ? 0
                            : limit_box->value();

  info_data.gray_strong_stem_width = gray_box->isChecked();
  info_data.gdi_cleartype_strong_stem_width = gdi_box->isChecked();
  info_data.dw_cleartype_strong_stem_width = dw_box->isChecked();

  info_data.increase_x_height = no_increase_box->isChecked()
                                ? 0
                                : increase_box->value();
  info_data.x_height_snapping_exceptions = x_height_snapping_exceptions;

  info_data.windows_compatibility = wincomp_box->isChecked();
  info_data.pre_hinting = pre_box->isChecked();
  info_data.hint_with_components = hint_box->isChecked();
  info_data.latin_fallback = fallback_box->currentIndex();
  info_data.symbol = symbol_box->isChecked();

  if (info_box->isChecked())
  {
    int ret = build_version_string(&info_data);
    if (ret == 1)
      QMessageBox::information(
        this,
        "TTFautohint",
        tr("Can't allocate memory for <b>TTFautohint</b> options string"
           " in <i>name</i> table."),
        QMessageBox::Ok,
        QMessageBox::Ok);
    else if (ret == 2)
      QMessageBox::information(
        this,
        "TTFautohint",
        tr("<b>TTFautohint</b> options string"
           " in <i>name</i> table too long."),
        QMessageBox::Ok,
        QMessageBox::Ok);
  }
  else
    info_func = NULL;

  QByteArray snapping_string = snapping_line->text().toLocal8Bit();

  TA_Error error =
    TTF_autohint("in-file, out-file,"
                 "hinting-range-min, hinting-range-max,"
                 "hinting-limit,"
                 "gray-strong-stem-width,"
                 "gdi-cleartype-strong-stem-width,"
                 "dw-cleartype-strong-stem-width,"
                 "error-string,"
                 "progress-callback, progress-callback-data,"
                 "info-callback, info-callback-data,"
                 "ignore-restrictions,"
                 "windows-compatibility,"
                 "pre-hinting,"
                 "hint-with-components,"
                 "increase-x-height,"
                 "x-height-snapping-exceptions,"
                 "fallback-script, symbol",
                 input, output,
                 info_data.hinting_range_min, info_data.hinting_range_max,
                 info_data.hinting_limit,
                 info_data.gray_strong_stem_width,
                 info_data.gdi_cleartype_strong_stem_width,
                 info_data.dw_cleartype_strong_stem_width,
                 &error_string,
                 gui_progress, &gui_progress_data,
                 info_func, &info_data,
                 ignore_restrictions,
                 info_data.windows_compatibility,
                 info_data.pre_hinting,
                 info_data.hint_with_components,
                 info_data.increase_x_height,
                 snapping_string.constData(),
                 info_data.latin_fallback, info_data.symbol);

  if (info_box->isChecked())
  {
    free(info_data.data);
    free(info_data.data_wide);
  }

  fclose(input);
  fclose(output);

  if (error)
  {
    if (handle_error(error, error_string, output_name))
      goto again;
  }
  else
    statusBar()->showMessage(tr("Auto-hinting finished."));
}
// Handle sniff message
short lister_handle_sniff(Lister *lister,SniffData *data)
{
	DirEntry *entry;
	long off;
	short show=0;

	// Find entry
	if ((entry=find_entry(&data->buffer->entry_list,data->name,&off,data->buffer->more_flags&DWF_CASE)))
	{
		char *version=0,*type=0;
		char buf[40];

		// Got a filetype?
		if (data->type || *data->type_name)
		{
			// Get name pointer
			if ((type=(data->type)?data->type->type.name:data->type_name) && *type)
			{
				// Set filetype description
				direntry_add_string(data->buffer,entry,DE_Filetype,type);

				// Directory sorted by filetype?
				if (data->buffer->buf_ListFormat.sort.sort==DISPLAY_FILETYPE)
				{
					// Remove entry
					remove_file_entry(data->buffer,entry);

					// Add it again
					add_file_entry(data->buffer,entry,0);
					show|=SNIFFF_SHOW;
				}
			}
		}

		// Got a version?
		if (data->flags&SNIFFF_VERSION)
		{
			// Set version
			direntry_add_version(data->buffer,entry,data->ver,data->rev,data->days);

			// Build version string
			build_version_string(buf,data->ver,data->rev,data->days,-1);
			version=buf;

			// Directory sorted by version?
			if (data->buffer->buf_ListFormat.sort.sort==DISPLAY_VERSION)
			{
				// Remove entry
				remove_file_entry(data->buffer,entry);

				// Add it again
				add_file_entry(data->buffer,entry,0);
				show|=SNIFFF_SHOW;
			}
		}

		// Is buffer currently visible?
		if (lister->cur_buffer==data->buffer &&
			!(lister->flags&LISTERF_VIEW_ICONS))
		{
			short len;

			// Type field changed, and don't have a custom width for filetype field?
			if (type && *type && !(data->buffer->buf_CustomWidthFlags&(1<<DISPLAY_FILETYPE)))
			{
				short old;

				// Get new field size
				old=data->buffer->buf_FieldWidth[DISPLAY_FILETYPE];
				lister_check_max_length(lister,type,&len,DISPLAY_FILETYPE);
				old-=data->buffer->buf_FieldWidth[DISPLAY_FILETYPE];

				// Field needs to be bigger?
				if (old<0)
				{
					// Add to width
					data->buffer->buf_HorizLength-=old;
					if (data->buffer->type_length<len)
						data->buffer->type_length=len;
					show|=SNIFFF_SLIDERS;
				}
			}

			// Same for version field
			if (version && !(data->buffer->buf_CustomWidthFlags&(1<<DISPLAY_VERSION)))
			{
				short old;

				// Get new field size
				old=data->buffer->buf_FieldWidth[DISPLAY_VERSION];
				lister_check_max_length(lister,version,&len,DISPLAY_VERSION);
				old-=data->buffer->buf_FieldWidth[DISPLAY_VERSION];

				// Field needs to be bigger?
				if (old<0)
				{
					// Add to width
					data->buffer->buf_HorizLength-=old;
					if (data->buffer->version_length<len)
						data->buffer->version_length=len;
					show|=SNIFFF_SLIDERS;
				}
			}

			// Update slider?
			if (show&SNIFFF_SLIDERS)
				show|=SNIFFF_SHOW;

			// Don't need to redraw?	
			else
			if (!(show&SNIFFF_SHOW))
			{
				// Is entry visible?
				if (off>=lister->cur_buffer->buf_VertOffset &&
					off<lister->cur_buffer->buf_VertOffset+lister->text_height)
				{
					// Show entry
					display_entry(entry,lister,off-lister->cur_buffer->buf_VertOffset);
				}
			}
		}
		else show=0;
	}

	return show;
}