コード例 #1
0
ファイル: draw.c プロジェクト: abrageddon/DLX-Opt
static	void	draw_nodes()
#endif
{
	GNODE v;

	debugmessage("draw_nodes","");
	
	if (supress_nodes) return;
	v = nodelist;
	while (v) {
		if (NWIDTH(v)==0) { v = NNEXT(v); continue; }
		gs_setshrink(G_stretch * NSTRETCH(v),
			     G_shrink  * NSHRINK(v)  );
		gs_setto(NX(v) * G_stretch / G_shrink,
			 NY(v) * G_stretch / G_shrink );

		draw_one_node(v);
		v = NNEXT(v);
	}
	
	v = labellist;
	while (v) {
		if (NWIDTH(v)==0) { v = NNEXT(v); continue; }
		gs_setshrink(G_stretch * NSTRETCH(v),
			     G_shrink  * NSHRINK(v)  );
		gs_setto(NX(v) * G_stretch / G_shrink,
			 NY(v) * G_stretch / G_shrink );
		gs_stringbox(v);
		v = NNEXT(v);
	}
#undef DEBUGDUMMY
#ifdef DEBUGDUMMY
	v = dummylist;
	while (v) {
		if ((NWIDTH(v)==0)&&(NHEIGHT(v)==0)) { 
			NWIDTH(v) = NHEIGHT(v) = 9; 
			NBORDERW(v) = 5; 
			NCOLOR(v) = BLACK; 
			gs_setshrink(G_stretch, G_shrink);
			gs_setto(NX(v) * G_stretch / G_shrink,
				 NY(v) * G_stretch / G_shrink );

			draw_one_node(v);
			NWIDTH(v) = NHEIGHT(v) = 0; 
			NBORDERW(v) = 0; 
		}
		v = NNEXT(v);
	}
	
#endif
	
	/*  Normal dummy nodes need not to be drawn, because they have no size. 
	 *  Anchor nodes are drawn.
	 */
	v = dummylist;
	while (v) {
		if (NANCHORNODE(v)) gs_anchornode(v);
		v = NNEXT(v);
	}
}
コード例 #2
0
ファイル: debugint.c プロジェクト: johkelly/MAME_hi
static void dview_draw_outlined_box(DView *dv, int rtype, int x, int y, int w, int h, rgb_t bg)
{
	rectangle r;

	dview_get_rect(dv, rtype, &r);
	ui_draw_outlined_box(dv->container, NX(dv, x + r.min_x), NY(dv, y + r.min_y),
			NX(dv, x + r.min_x + w), NY(dv, y + r.min_y + h), bg);
}
コード例 #3
0
ファイル: debugint.c プロジェクト: johkelly/MAME_hi
static void dview_draw_box(DView *dv, int rtype, int x, int y, int w, int h, rgb_t col)
{
	rectangle r;

	dview_get_rect(dv, rtype, &r);
	dv->container->add_rect(NX(dv, x + r.min_x), NY(dv, y + r.min_y),
			NX(dv, x + r.min_x + w), NY(dv, y + r.min_y + h), col,
			PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
}
コード例 #4
0
ファイル: debugint.c プロジェクト: johkelly/MAME_hi
static void dview_draw_char(DView *dv, int rtype, int x, int y, int h, rgb_t col, UINT16 ch)
{
	rectangle r;

	dview_get_rect(dv, rtype, &r);
	dv->container->add_char(
			NX(dv, x + r.min_x),
			NY(dv, y + r.min_y),
			NY(dv, h),
			debug_font_aspect,
			//(float) rect_get_height(&dv->bounds) / (float) rect_get_width(&dv->bounds), //render_get_ui_aspect(),
			col,
			*debug_font,
			ch);
}
コード例 #5
0
ファイル: formatting.cpp プロジェクト: DragonZX/mkvtoolnix
std::string
create_minutes_seconds_time_string(unsigned int seconds,
                                   bool omit_minutes_if_zero) {
  unsigned int minutes = seconds / 60;
  seconds              = seconds % 60;

  std::string  result  = (boost::format(NY("%1% second", "%1% seconds", seconds)) % seconds).str();

  if (!minutes && omit_minutes_if_zero)
    return result;

  return (  boost::format("%1% %2%")
          % (boost::format(NY("%1% minute", "%1% minutes", minutes)) % minutes)
          % result).str();
}
コード例 #6
0
void
scanning_for_playlists_dlg::update_gauge(size_t progress) {
  m_progress = progress;
  m_g_progress->SetValue(m_progress);
  m_st_progress->SetLabel(wxU(boost::format(NY("%1% of %2% file processed", "%1% of %2% files processed", m_max_progress)) % m_progress % m_max_progress));
#if defined(SYS_WINDOWS)
  if (m_taskbar_progress)
    m_taskbar_progress->set_value(m_progress, m_max_progress);
#endif  // SYS_WINDOWS
}
コード例 #7
0
ファイル: DataSet_3D.cpp プロジェクト: SAMAN-64/cpptraj
void DataSet_3D::GridInfo() const {
  if (gridBin_ == 0) return;
  Vec3 const& oxyz = gridBin_->GridOrigin();
  mprintf("\t\t-=Grid Dims=- %8s %8s %8s\n", "X", "Y", "Z");
  mprintf("\t\t        Bins: %8zu %8zu %8zu\n", NX(), NY(), NZ());
  mprintf("\t\t      Origin: %8g %8g %8g\n", oxyz[0], oxyz[1], oxyz[2]);
  if (gridBin_->IsOrthoGrid()) {
    GridBin_Ortho const& gb = static_cast<GridBin_Ortho const&>( *gridBin_ );
    mprintf("\t\t     Spacing: %8g %8g %8g\n", gb.DX(), gb.DY(), gb.DZ());
    mprintf("\t\t      Center: %8g %8g %8g\n",
            oxyz[0] + (NX()/2)*gb.DX(),
            oxyz[1] + (NY()/2)*gb.DY(),
            oxyz[2] + (NZ()/2)*gb.DZ());
    //mprintf("\tGrid max    : %8.3f %8.3f %8.3f\n", grid.MX(), grid.MY(), grid.MZ());
  } else {
    Box box(gridBin_->Ucell());
    mprintf("\t\tBox: %s ABC={%g %g %g} abg={%g %g %g}\n", box.TypeName(),
            box[0], box[1], box[2], box[3], box[4], box[5]);
  }
}
コード例 #8
0
ファイル: CMascara.cpp プロジェクト: ldsc/lib_ldsc
/*
==================================================================================
Documentacao      CalculaPeso
==================================================================================
Descrição:
		Existem dois tipos de mascaras, uma com peso=1 e outras com peso>1
		Se a mascara tiver peso maior que 1 esta funcao deve ser chamada
		Ou o peso deve ser calculado diretamente na funcao de preenchimento da mascara
Programador:   Andre Duarte Bueno
*/
float CMascara::CalculaPeso () {
    peso = 0;
    for (unsigned int i = 0; i < NX (); i++) {	//   percorre a mascara
        for (unsigned int j = 0; j < NY (); j++) {
            peso += data2D[i][j];	//   calcula peso acumulado
        }
    }
    if (peso == 0) {
        peso = 1;			//   o peso é utilizado no filtro numa divisao
	}
    return peso;			//   e nao pode assumir o valor 0
}
コード例 #9
0
scanning_for_playlists_dlg::scanning_for_playlists_dlg(wxWindow *parent,
                                                       wxString const &original_file_name,
                                                       wxArrayString const &original_output,
                                                       std::vector<wxString> const &other_file_names)
  : wxDialog{parent, wxID_ANY, Z("Scanning directory")}
#if defined(SYS_WINDOWS)
  , m_taskbar_progress{}
#endif  // SYS_WINDOWS
  , m_scanner{new scan_directory_thread_c{this, other_file_names}}
  , m_aborted{}
  , m_progress{}
  , m_max_progress{other_file_names.size()}
  , m_start_time{}
  , m_next_remaining_time_update{}
{
	m_st_progress           = new wxStaticText(this, wxID_ANY,    wxU(boost::format(NY("%1% of %2% file processed", "%1% of %2% files processed", other_file_names.size())) % 0 % other_file_names.size()));
	m_g_progress            = new wxGauge(     this, wxID_ANY,    m_max_progress);
  auto st_remaining_label = new wxStaticText(this, wxID_ANY,    Z("Remaining time:"));
	m_st_remaining_time     = new wxStaticText(this, wxID_ANY,    Z("is being estimated"));
	m_b_abort               = new wxButton(    this, wxID_CANCEL, Z("&Abort"));

#if defined(SYS_WINDOWS)
  if (get_windows_version() >= WINDOWS_VERSION_7) {
    m_taskbar_progress = new taskbar_progress_c(mdlg);
    m_taskbar_progress->set_state(TBPF_NORMAL);
    m_taskbar_progress->set_value(0, other_file_names.size());
  }
#endif  // SYS_WINDOWS

  auto siz_remaining_time = new wxBoxSizer(wxHORIZONTAL);
  siz_remaining_time->Add(st_remaining_label,  0, wxALL, 5);
  siz_remaining_time->Add(m_st_remaining_time, 0, wxALL, 5);

	auto siz_button = new wxBoxSizer(wxHORIZONTAL);
	siz_button->AddStretchSpacer();
	siz_button->Add(m_b_abort, 0, wxALL, 5);
	siz_button->AddStretchSpacer();

	auto siz_all = new wxBoxSizer(wxVERTICAL);
	siz_all->Add(m_st_progress,      0, wxALL,            5);
	siz_all->Add(m_g_progress,       0, wxALL | wxEXPAND, 5);
	siz_all->Add(siz_remaining_time, 0, wxALL,            5);
	siz_all->Add(siz_button,         1, wxEXPAND,         5);

	SetSizerAndFit(siz_all);
  auto min_size = GetMinSize();
  SetSize(wxSize{min_size.GetWidth() + 50, min_size.GetHeight()});
	Layout();

	Centre(wxBOTH);

  parse_output(original_file_name, original_output);
}
コード例 #10
0
ask_scan_for_playlists_dlg::ask_scan_for_playlists_dlg(wxWindow *parent,
                                                       size_t num_other_files)
  : wxDialog{parent, wxID_ANY, Z("Scan directory for other playlists")}
{
	SetSize(500, 150);

  auto text = wxU(boost::format("%1% %2% %3%")
                  % Y("The file you've added is a playlist.")
                  % (boost::format(NY("The directory it is located in contains %1% other file with the same extension.",
                                      "The directory it is located in contains %1% other files with the same extension.",
                                      num_other_files))
                     % num_other_files)
                  % Y("mmg can scan these files, present the results including duration and number of tracks of each playlist found and let you choose which one to add."));
	auto st_question = new wxStaticText(this, wxID_ANY, text);
	st_question->Wrap(480);

	auto st_in_the_future = new wxStaticText(this, wxID_ANY, Z("What to do in the future:"), wxDefaultPosition, wxDefaultSize, 0);

  wxString const scan_directory_for_playlists_choices[] = {
    Z("always ask the user"),
    Z("always scan for other playlists"),
    Z("never scan for other playlists"),
  };
  m_cob_in_the_future = new wxMTX_COMBOBOX_TYPE(this, wxID_ANY, Z("always ask the user"), wxDefaultPosition, wxDefaultSize, 3, scan_directory_for_playlists_choices, wxCB_READONLY);
	m_cob_in_the_future->SetSelection(mdlg->options.scan_directory_for_playlists);


	auto b_scan      = new wxButton(this, wxID_OK,     Z("&Scan for other playlists"));
	auto b_dont_scan = new wxButton(this, wxID_CANCEL, Z("&Don't scan, just add the file"));
  b_scan->SetDefault();

	auto siz_in_the_future = new wxBoxSizer(wxHORIZONTAL);
	siz_in_the_future->Add(st_in_the_future,    0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
	siz_in_the_future->Add(m_cob_in_the_future, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);

	auto siz_buttons = new wxBoxSizer(wxHORIZONTAL);
	siz_buttons->AddStretchSpacer();
	siz_buttons->Add(b_scan);
	siz_buttons->AddStretchSpacer();
	siz_buttons->Add(b_dont_scan);
	siz_buttons->AddStretchSpacer();

	auto siz_all = new wxBoxSizer(wxVERTICAL);
	siz_all->Add(st_question,       0, wxALL,    5);
	siz_all->Add(siz_in_the_future, 1, wxEXPAND, 5);
	siz_all->Add(siz_buttons,       1, wxEXPAND, 5);

	SetSizerAndFit(siz_all);
	Layout();

	Centre(wxBOTH);
}
コード例 #11
0
ファイル: rtc.c プロジェクト: iPodLinux/linux-2.4.24-ipod
static int rtc_proc_output (char *buf)
{
#define YN(bit) ((ctrl & bit) ? "yes" : "no")
#define NY(bit) ((ctrl & bit) ? "no" : "yes")
	char *p;
	struct rtc_time tm;
	unsigned char batt, ctrl;
	unsigned long freq;

	spin_lock_irq(&rtc_lock);
	batt = CMOS_READ(RTC_VALID) & RTC_VRT;
	ctrl = CMOS_READ(RTC_CONTROL);
	freq = rtc_freq;
	spin_unlock_irq(&rtc_lock);

	p = buf;

	get_rtc_time(&tm);

	/*
	 * There is no way to tell if the luser has the RTC set for local
	 * time or for Universal Standard Time (GMT). Probably local though.
	 */
	p += sprintf(p,
		     "rtc_time\t: %02d:%02d:%02d\n"
		     "rtc_date\t: %04d-%02d-%02d\n"
	 	     "rtc_epoch\t: %04lu\n",
		     tm.tm_hour, tm.tm_min, tm.tm_sec,
		     tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, epoch);

	get_rtc_alm_time(&tm);

	/*
	 * We implicitly assume 24hr mode here. Alarm values >= 0xc0 will
	 * match any value for that particular field. Values that are
	 * greater than a valid time, but less than 0xc0 shouldn't appear.
	 */
	p += sprintf(p, "alarm\t\t: ");
	if (tm.tm_hour <= 24)
		p += sprintf(p, "%02d:", tm.tm_hour);
	else
		p += sprintf(p, "**:");

	if (tm.tm_min <= 59)
		p += sprintf(p, "%02d:", tm.tm_min);
	else
		p += sprintf(p, "**:");

	if (tm.tm_sec <= 59)
		p += sprintf(p, "%02d\n", tm.tm_sec);
	else
		p += sprintf(p, "**\n");

	p += sprintf(p,
		     "DST_enable\t: %s\n"
		     "BCD\t\t: %s\n"
		     "24hr\t\t: %s\n"
		     "square_wave\t: %s\n"
		     "alarm_IRQ\t: %s\n"
		     "update_IRQ\t: %s\n"
		     "periodic_IRQ\t: %s\n"
		     "periodic_freq\t: %ld\n"
		     "batt_status\t: %s\n",
		     YN(RTC_DST_EN),
		     NY(RTC_DM_BINARY),
		     YN(RTC_24H),
		     YN(RTC_SQWE),
		     YN(RTC_AIE),
		     YN(RTC_UIE),
		     YN(RTC_PIE),
		     freq,
		     batt ? "okay" : "dead");

	return  p - buf;
#undef YN
#undef NY
}
コード例 #12
0
ファイル: main.cpp プロジェクト: scalexm/GeoShoot
int Run(int argc, char ** argv) {
    int N = 10;
    int nbIterations = 10;
    std::string momentumPath, outputPath = "./", deviceName, sourcePath = "./OpenCL.cl";

    if (argc < 3) {
        usage();
        return 1;
    }

    auto image = ScalarField::Read({ argv[1] });
    auto target = ScalarField::Read({ argv[2] });

    argc -= 2;
    argv += 2;

    Matrix<4, 4> transfo;
    memset(&transfo[0], 0, 16 * sizeof(float));
    transfo[0][0] = transfo[1][1] = transfo[2][2] = transfo[3][3] = 1;

    std::array<float, 7> weights = {{ 100.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f }},
        sigmaXs = {{ 3.f, 3.f, 3.f, 3.f, 3.f, 3.f, 3.f }},
        sigmaYs = {{ 3.f, 3.f, 3.f, 3.f, 3.f, 3.f, 3.f }},
        sigmaZs = {{ 3.f, 3.f, 3.f, 3.f, 3.f, 3.f, 3.f }};

    float alpha = 0.001f, maxVeloUpdate = 0.5f;

    while (argc > 1) {
        auto arg = std::string { argv[1] };
        --argc; ++argv;
        if (arg == "-subdivisions" && argc > 1) {
            N = atoi(argv[1]);
            --argc; ++argv;
        } else if (arg == "-iterations" && argc > 1) {
            nbIterations = atoi(argv[1]);
            --argc; ++argv;
        } else if (arg == "-InputInitMomentum" && argc > 1) {
            momentumPath = argv[1];
            --argc; ++argv;
        } else if (arg == "-OutputPath" && argc > 1) {
            outputPath = argv[1];
            --argc; ++argv;
        } else if (arg == "-Device" && argc > 1) {
            deviceName = argv[1];
            --argc; ++argv;
        } else if (arg == "-ShowDevices") {
            for (auto && d : compute::system::devices())
                std::cout << d.name() << std::endl;
            return 0;
        } else if (arg == "-affineT" && argc > 12) {
            for (auto i = 1; i <= 12; ++i)
                transfo[(i - 1) / 4][(i - 1) % 4] = atof(argv[i]);
            argc -= 12;
            argv += 12;
        } else if (arg == "-Gauss" && argc > 1) {
            sigmaXs[0] = sigmaYs[0] = sigmaZs[0] = atof(argv[1]);
            --argc; ++argv;
        } else if (arg == "-M_gauss" && argc > 1) {
            auto temp = atoi(argv[1]);
            --argc; ++argv;
            for (auto i = 1; i <= 7; ++i) {
                if (temp >= i && argc > 2) {
                    weights[i - 1] = atof(argv[1]);
                    sigmaXs[i - 1] = sigmaYs[i - 1] = sigmaZs[i - 1] = atof(argv[2]);
                    argc -= 2;
                    argv += 2;
                }
            }
        } else if (arg == "-M_Gauss_easier" && argc > 2) {
            sigmaXs[0] = atof(argv[1]);
            sigmaXs[6] = atof(argv[2]);
            argc -= 2;
            argv += 2;

            if (sigmaXs[0] < sigmaXs[6]) {
                std::swap(sigmaXs[0], sigmaXs[6]);
            }

            sigmaYs[0] = sigmaZs[0] = sigmaXs[0];
            sigmaYs[6] = sigmaZs[6] = sigmaXs[6];

            weights[0] = 0.f;

            auto a = (sigmaYs[6] - sigmaYs[0]) / 6.f;
            auto b = sigmaYs[0] - a;

            for (auto i = 2; i <= 6; ++i)
                sigmaXs[i - 1] = sigmaYs[i - 1] = sigmaZs[i - 1] = i * a + b;
        } else if (arg == "-alpha" && argc > 1) {
            alpha = atof(argv[1]);
            --argc; ++argv;
        } else if (arg == "-MaxVeloUpdate" && argc > 1) {
            maxVeloUpdate = atof(argv[1]);
            --argc; ++argv;
        } else if (arg == "-KernelSource" && argc > 1) {
            sourcePath = argv[1];
            --argc; ++argv;
        } else {
            usage();
            return 1;
        }
    }

    ScalarField momentum;
    if (momentumPath.empty()) {
        momentum = ScalarField { image.NX(), image.NY(), image.NZ() };
        momentum.Fill(0.f);
    } else
        momentum = ScalarField::Read({ momentumPath.c_str() });


    if (deviceName.empty())
        SetDevice(compute::system::default_device());
    else
        SetDevice(compute::system::find_device(deviceName));

    std::cout << "OpenCL will use " << GetDevice().name() << std::endl;
    compute::command_queue queue { GetContext(), GetDevice() };
    SetSourcePath(std::move(sourcePath));

    GeoShoot gs { std::move(image), std::move(target), std::move(momentum), transfo, N, queue };

    gs.Weights = std::move(weights);
    gs.SigmaXs = std::move(sigmaXs);
    gs.SigmaYs = std::move(sigmaYs);
    gs.SigmaZs = std::move(sigmaZs);
    gs.Alpha = alpha;
    gs.MaxUpdate = maxVeloUpdate;

    gs.Run(nbIterations);
    queue.finish();

    gs.Save(outputPath);

    return 0;
}
コード例 #13
0
void
generic_reader_c::display_identification_results() {
  std::string format_file, format_track, format_attachment, format_att_description, format_att_file_name;

  if (g_identify_for_mmg) {
    format_file            =   "File '%1%': container: %2%";
    format_track           =   "Track ID %1%: %2% (%3%)";
    format_attachment      =   "Attachment ID %1%: type \"%2%\", size %3% bytes";
    format_att_description =   ", description \"%1%\"";
    format_att_file_name   =   ", file name \"%1%\"";

  } else {
    format_file            = Y("File '%1%': container: %2%");
    format_track           = Y("Track ID %1%: %2% (%3%)");
    format_attachment      = Y("Attachment ID %1%: type '%2%', size %3% bytes");
    format_att_description = Y(", description '%1%'");
    format_att_file_name   = Y(", file name '%1%'");
  }

  mxinfo(boost::format(format_file) % m_ti.m_fname % m_id_results_container.info);

  if (g_identify_verbose && !m_id_results_container.verbose_info.empty())
    mxinfo(boost::format(" [%1%]") % join(" ", m_id_results_container.verbose_info));

  mxinfo("\n");

  for (auto &result : m_id_results_tracks) {
    mxinfo(boost::format(format_track) % result.id % result.type % result.info);

    if (g_identify_verbose && !result.verbose_info.empty())
      mxinfo(boost::format(" [%1%]") % join(" ", result.verbose_info));

    mxinfo("\n");
  }

  for (auto &result : m_id_results_attachments) {
    mxinfo(boost::format(format_attachment) % result.id % id_escape_string(result.type) % result.size);

    if (!result.description.empty())
      mxinfo(boost::format(format_att_description) % id_escape_string(result.description));

    if (!result.info.empty())
      mxinfo(boost::format(format_att_file_name) % id_escape_string(result.info));

    if (g_identify_verbose && !result.verbose_info.empty())
      mxinfo(boost::format(" [%1%]") % join(" ", result.verbose_info));

    mxinfo("\n");
  }

  for (auto &result : m_id_results_chapters) {
    if (g_identify_for_mmg)
      mxinfo(boost::format("Chapters: %1% entries") % result.size);
    else
      mxinfo(boost::format(NY("Chapters: %1% entry", "Chapters: %1% entries", result.size)) % result.size);
    mxinfo("\n");
  }

  for (auto &result : m_id_results_tags) {
    if (ID_RESULT_GLOBAL_TAGS_ID == result.id) {
      if (g_identify_for_mmg)
        mxinfo(boost::format("Global tags: %1% entries") % result.size);
      else
        mxinfo(boost::format(NY("Global tags: %1% entry", "Global tags: %1% entries", result.size)) % result.size);

    } else if (g_identify_for_mmg)
      mxinfo(boost::format("Tags for track ID %1%: %2% entries") % result.id % result.size);
    else
      mxinfo(boost::format(NY("Tags for track ID %1%: %2% entry", "Tags for track ID %1%: %2% entries", result.size)) % result.id % result.size);

    mxinfo("\n");
  }
}