void CL_SpanLayout_Impl::layout(CL_GraphicContext &gc, int max_width) { layout_lines(gc, max_width); switch (alignment) { case cl_right: align_right(max_width); break; case cl_center: align_center(max_width); break; case cl_justify: align_justify(max_width); break; case cl_left: default: break; } }
int ft_puto(char **ptr, va_list *ap, t_format *f) { unsigned int i; int w; int p; set_space(ap, f); w = f->width; p = f->prec; i = va_arg(*ap, unsigned int); (*ptr)++; if (f->flags & 4) return (align_left(i, w, p, f)); else return (align_right(i, w, p, f)); }
int ft_putp(char **ptr, va_list *ap, t_format *f) { unsigned long l; int p; int w; set_space(ap, f); w = f->width; p = f->prec; l = va_arg(*ap, unsigned long); (*ptr)++; if (f->flags & 4) return (align_left(l, w, p, f)); else return (align_right(l, w, p, f)); }
int phypp_main(int argc, char* argv[]) { if (argc < 2) { print("usage: make_shifts <ob_filter> [options]"); return 0; } vec1u exclude; std::string helper; read_args(argc-1, argv+1, arg_list(exclude, helper)); if (helper.empty()) { error("please provide the name of (one of) the helper target you used to " "calibrate the shifts (helper=...)"); return 1; } helper = tolower(helper); std::string scis = argv[1]; vec1d cent_ra, cent_dec; file::read_table("centroid_helper.txt", 0, cent_ra, cent_dec); vec1u ids = uindgen(cent_ra.size())+1; vec1u idex = where(is_any_of(ids, exclude)); inplace_remove(ids, idex); inplace_remove(cent_ra, idex); inplace_remove(cent_dec, idex); std::ofstream cmb("combine.sof"); vec1d shx, shy; vec1d x0, y0; bool first_line = true; uint_t nexp = 0; for (uint_t i : range(ids)) { std::string dir = scis+align_right(strn(ids[i]), 2, '0')+"/"; print(dir); vec1s files = dir+file::list_files(dir+"sci_reconstructed*-sci.fits"); inplace_sort(files); // Find out which exposures contain the helper target from which the // shifts were calibrated vec1u ignore; for (uint_t k : range(files)) { std::string f = files[k]; fits::generic_file fcubes(f); vec1s arms(24); bool badfile = false; for (uint_t u : range(24)) { if (!fcubes.read_keyword("ESO OCS ARM"+strn(u+1)+" NAME", arms[u])) { note("ignoring invalid file '", f, "'"); note("missing keyword 'ESO OCS ARM"+strn(u+1)+" NAME'"); ignore.push_back(k); badfile = true; break; } } if (badfile) continue; arms = tolower(trim(arms)); vec1u ida = where(arms == helper); if (ida.empty()) { ignore.push_back(k); } else if (x0.empty()) { // Get astrometry of IFUs from first exposure // NB: assumes the rotation is the same for all exposures, // which is anyway what kmos_combine does later on. fcubes.reach_hdu(ida[0]+1); fits::wcs astro(fcubes.read_header()); fits::ad2xy(astro, cent_ra, cent_dec, x0, y0); } } inplace_remove(files, ignore); if (files.empty()) { warning("folder ", dir, " does not contain any usable file"); continue; } for (std::string f : files) { cmb << f << " COMMAND_LINE\n"; ++nexp; } double dox = x0[0] - x0[i], doy = y0[0] - y0[i]; if (first_line) { // Ommit first line which has, by definition, no offset first_line = false; } else { shx.push_back(dox); shy.push_back(doy); } if (file::exists(dir+"helpers/shifts.txt")) { vec1d tx, ty; file::read_table(dir+"helpers/shifts.txt", 0, tx, ty); for (uint_t j : range(tx)) { shx.push_back(dox+tx[j]); shy.push_back(doy+ty[j]); } } } note("found ", nexp, " exposures"); cmb.close(); auto truncate_decimals = vectorize_lambda([](double v, uint_t nd) { return long(v*e10(nd))/e10(nd); }); shx = truncate_decimals(shx, 2); shy = truncate_decimals(shy, 2); file::write_table("shifts.txt", 10, shx, shy); return 0; }
inline auto align_right_bottom(Subject&& subject) { return align_right(align_bottom(std::forward<Subject>(subject))); }
inline auto align_right_middle(Subject&& subject) { return align_right(align_middle(std::forward<Subject>(subject))); }
inline auto align_right_top(Subject&& subject) { return align_right(align_top(std::forward<Subject>(subject))); }
,{QN("Set foreground color"), NULL, "icon-foreground-color.png", SLOT(foreground_color()), NA } ,{QN("Set background color"), NULL, "icon-background-color.png", SLOT(background_color()), NA } ,{QN("Insert image"), NULL, "icon-image.png", SLOT(insert_image()), NA } ,{QN("Insert link"), NULL, "icon-link.png", SLOT(insert_link()), NA } ,{QN("Insert horizontal rule"), NULL, "icon-hr.png", SLOT(insert_hr()), NA } ,{QN("Insert unordered list"), NULL, "icon-bullet-list.png", SLOT(insert_unordered_list()), NA } ,{QN("Insert ordered list"), NULL, "icon-ordered-list.png", SLOT(insert_ordered_list()), NA } ,{QN("Remove format"), NULL, "icon-eraser.png", SLOT(remove_format()), NA } ,{QN("Cut"), NULL, "icon-cut.png", NULL, QWebPage::Cut } ,{QN("Copy"), NULL, "icon-copy.png", NULL, QWebPage::Copy } ,{QN("Paste"), NULL, "icon-paste.png", NULL, QWebPage::Paste } ,{QN("Undo"), QN("Ctrl+Z"), "icon-undo.png", NULL, QWebPage::Undo } ,{QN("Redo"), NULL, "icon-redo.png", NULL, QWebPage::Redo } ,{QN("Align left"), NULL, "icon-align-left.png", SLOT(align_left()), NA } ,{QN("Justify"), NULL, "icon-justify.png", SLOT(justify()), NA } ,{QN("Align right"), NULL, "icon-align-right.png", SLOT(align_right()), NA } ,{QN("Center"), NULL, "icon-center.png", SLOT(center()), NA } ,{QN("Indent right"), NULL, "icon-indent-right.png", SLOT(indent_right()), NA } ,{QN("Indent left"), NULL, "icon-indent-left.png", SLOT(indent_left()), NA } #undef NA #undef QN }; link_editor::link_editor(QWidget* parent): QDialog(parent) { setWindowTitle(tr("Edit link")); QVBoxLayout* layout = new QVBoxLayout(this); QGridLayout* grid = new QGridLayout(); layout->addLayout(grid);