void tex::flush_discretionary(ptr p) { begin_diagnostic(); print_nl("The following discretionary sublist has been deleted:"); show_box(p); end_diagnostic(TRUE); flush_node_list(p); }
void save_and_draw( HELP_WINDOW *hw, struct screen *help_heading, WINDOW **w_ptr ) { window_control( w_ptr, SAVE, hw->ulft_col, hw->ulft_row, hw->total_col, hw->total_row ); make_window( hw->ulft_col, hw->ulft_row, hw->total_col, hw->total_row, NORMAL ); show_box( hw->ulft_col, hw->ulft_row, help_heading, NORMAL ); }
void tex::box_error(int n) { error(); begin_diagnostic(); print_nl("The following box has been deleted:"); show_box(box(n)); end_diagnostic(TRUE); flush_node_list(box(n)); box(n) = null; }
void tdemacro( void ) { int c; char fname[82]; FILE *macro_file; cls( ); show_box( 0, 0, macro_screen, NORMAL ); xygoto( 42, 14 ); c = getkey( ); while (c != '1' && c != '2') c = getkey( ); if (c == '1') { puts( "" ); puts( "" ); puts( "" ); puts( "Enter file name that contains the macro definitions :" ); gets( fname ); if ((c = access( fname, EXIST )) != 0) { puts( "\nFile not found. Press any key to continue." ); c = getkey( ); cls( ); return; } else if ((macro_file = fopen( fname, "rb" )) == NULL ) { puts( "\nCannot open macro file. Press any key to contine." ); c = getkey( ); cls( ); return; } fread( (void *)¯os.first_stroke[0], sizeof(int), MAX_KEYS, macro_file ); fread( (void *)¯os.strokes[0], sizeof(STROKES), STROKE_LIMIT, macro_file ); fseek( tde_exe, macro_offset + 8, SEEK_SET ); fwrite( (void *)¯os.first_stroke[0], sizeof(int), MAX_KEYS, tde_exe ); fwrite( (void *)¯os.strokes[0], sizeof(STROKES), STROKE_LIMIT, tde_exe ); fclose( macro_file ); puts( "" ); puts( "" ); puts( "" ); puts( "New macros successfully installed. Press any key to continue." ); c = getkey( ); } cls( ); }
void tex::show_cur_page() { ptr p, q; int t; if (page_head == page_tail) return; print_nl("### current page:"); if (output_active) print(" (held over for next output)"); show_box(link(page_head)); if (page_contents > EMPTY) { print_nl("total height "); print_totals(); print_nl(" goal height "); print_scaled(page_goal); p = link(page_ins_head); while (p != page_ins_head) { print_ln(); print_esc("insert"); t = subtype(p); print_int(t); print(" adds "); t = x_over_n(page_ins_height(p), 1000) * count(t); print_scaled(t); if (type(p) == SPLIT_UP) { q = page_head; t = 0; do { q = link(q); if (type(q) == INS_NODE && subtype(q) == subtype(p)) incr(t); } while (q != broken_ins(p)); print(", #"); print_int(t); print(" might split"); } p = link(p); } } }
void pdf_ship_out (pointer p) { integer page_loc; char j, k; if (tracing_output > 0) { print_nl(""); print_ln(); prints("Completed box being shipped out"); } if (term_offset > max_print_line - 9) print_ln(); else if ((term_offset > 0) || (file_offset > 0)) print_char(' '); print_char('['); j = 9; while ((count(j) == 0) && (j > 0)) decr(j); for (k = 0; k <= j; k++) { print_int(count(k)); if (k < j) print_char('.'); } update_terminal(); if (tracing_output > 0) { print_char(']'); begin_diagnostic(); show_box(p); end_diagnostic(true); } if ((height(p) > max_dimen) || (depth(p) > max_dimen) || (height(p) + depth(p) + v_offset > max_dimen) || (width(p) + h_offset > max_dimen)) { print_err("Huge page cannot be shipped out"); help2("The page just created is more than 18 feet tall or", "more than 18 feet wide, so I suspect something went wrong."); error(); if (tracing_output <= 0) { begin_diagnostic(); print_nl("The following box has been deleted:"); show_box(p); end_diagnostic(true); } goto done; } if (height(p) + depth(p) + v_offset > max_v) max_v = height(p) + depth(p) + v_offset; if (width(p) + h_offset > max_h) max_h = width(p) + h_offset; dvi_h = 0; dvi_v = 0; cur_h = h_offset; dvi_f = null_font; ensure_pdf_open(); if (total_pages == 0) { pdf_set_version(5); pdf_set_compression(9); pdf_init_fontmaps(); read_config_file("dvipdfmx.cfg"); pdf_doc_set_producer("Y&YTeX 2.3.0"); pdf_doc_set_creator("TeX"); pdf_files_init(); pdf_init_device(0.000015202, 2, 0); // TODO: pdfTeX's page width and height. // page_width = pdf_page_width != 0 ? <- : width(p) + 2 * (pdf_h_origin + h_offset); // page_height = pdf_page_height != 0 ? <- : height(p) + depth(p) + 2 * (pdf_v_origin + v_offset); pdf_open_document(pdf_file_name, 0, 595.0, 842.0, 0, 0, (1 << 4)); spc_exec_at_begin_document(); } page_loc = dvi_offset + dvi_ptr; pdf_doc_begin_page(1.0, 72.0, 770.0); spc_exec_at_begin_page(); last_bop = page_loc; cur_v = height(p) + v_offset; temp_ptr = p; if (type(p) == vlist_node) pdf_vlist_out(); else pdf_hlist_out(); spc_exec_at_end_page(); pdf_doc_end_page(); incr(total_pages); cur_s = -1; done: if (tracing_output <= 0) print_char(']'); dead_cycles = 0; update_terminal(); #ifdef STAT if (tracing_stats > 1) { print_nl("Memory usage before: "); print_int(var_used); print_char('&'); print_int(dyn_used); print_char(';'); } #endif flush_node_list(p); #ifdef STAT if (tracing_stats > 1) { prints(" after: "); print_int(var_used); print_char('&'); print_int(dyn_used); prints("; still utouched: "); print_int(hi_mem_min - lo_mem_max - 1); print_ln(); } #endif }
void show_solution(const successfull result[ITEMS], const box matrix, int found) { cout << "\nFound Solution (" << found << "):\n"; show_result(result); show_box(matrix); }
widgetdock_calc_laser_line::widgetdock_calc_laser_line(): QDockWidget(tr("Laser line")), method_(tr("Calculation method")), method_threshold_(tr("Threshold")), method_sum_(tr("Sum")), threshold_(tr("Settings")), threshold_show_original_(tr("Show original")), threshold_show_binarize_(tr("Show binarized")), threshold_binarize_l_(tr("Threshold: ")), threshold_show_erode_(tr("Show eroded")), threshold_erode_l_(tr("Erode: ")), threshold_show_line_(tr("Show line")), threshold_subpixel_l_(tr("Subpixel: ")), sum_(tr("Settings")), sum_show_original_(tr("Show original")), sum_min_value_l_(tr("Minimal value: ")), sum_min_sum_l_(tr("Minimal sum: ")), sum_show_line_(tr("Show line")), sum_subpixel_l_(tr("Subpixel: ")) { method_layout_.addWidget(&method_sum_); method_layout_.addWidget(&method_threshold_); method_sum_.setChecked(true); method_.setLayout(&method_layout_); threshold_binarize_.setRange(1, 255); threshold_erode_.setRange(0, 10); threshold_layout_.addWidget(&threshold_show_original_, 0, 0, 1, 2); threshold_layout_.addWidget(&threshold_show_binarize_, 1, 0, 1, 2); threshold_layout_.addWidget(&threshold_binarize_l_, 2, 0, 1, 1); threshold_layout_.addWidget(&threshold_binarize_, 2, 1, 1, 1); threshold_layout_.addWidget(&threshold_show_erode_, 3, 0, 1, 2); threshold_layout_.addWidget(&threshold_erode_l_, 4, 0, 1, 1); threshold_layout_.addWidget(&threshold_erode_, 4, 1, 1, 1); threshold_layout_.addWidget(&threshold_show_line_, 5, 0, 1, 2); threshold_layout_.addWidget(&threshold_subpixel_l_, 6, 0, 1, 1); threshold_layout_.addWidget(&threshold_subpixel_, 6, 1, 1, 1); threshold_show_line_.setChecked(true); threshold_binarize_.setValue(255); threshold_erode_.setValue(2); threshold_subpixel_.setChecked(true); threshold_binarize_l_.setAlignment(Qt::AlignRight | Qt::AlignVCenter); threshold_erode_l_.setAlignment(Qt::AlignRight | Qt::AlignVCenter); threshold_subpixel_l_.setAlignment(Qt::AlignRight | Qt::AlignVCenter); threshold_.setLayout(&threshold_layout_); sum_min_value_.setRange(0, 254); sum_min_sum_.setRange(0, 200000); sum_layout_.addWidget(&sum_show_original_, 0, 0, 1, 2); sum_layout_.addWidget(&sum_min_value_l_, 1, 0, 1, 1); sum_layout_.addWidget(&sum_min_value_, 1, 1, 1, 1); sum_layout_.addWidget(&sum_min_sum_l_, 2, 0, 1, 1); sum_layout_.addWidget(&sum_min_sum_, 2, 1, 1, 1); sum_layout_.addWidget(&sum_show_line_, 3, 0, 1, 2); sum_layout_.addWidget(&sum_subpixel_l_, 4, 0, 1, 1); sum_layout_.addWidget(&sum_subpixel_, 4, 1, 1, 1); sum_show_line_.setChecked(true); sum_min_value_.setValue(128); sum_min_sum_.setValue(500); sum_subpixel_.setChecked(true); sum_min_value_l_.setAlignment(Qt::AlignRight | Qt::AlignVCenter); sum_min_sum_l_.setAlignment(Qt::AlignRight | Qt::AlignVCenter); sum_subpixel_l_.setAlignment(Qt::AlignRight | Qt::AlignVCenter); sum_.setLayout(&sum_layout_); main_layout_.addWidget(&method_); main_layout_.addWidget(&threshold_); main_layout_.addWidget(&sum_); main_layout_.addStretch(); main_widget_.setLayout(&main_layout_); setWidget(&main_widget_); threshold_.hide(); constexpr auto released = &QRadioButton::released; constexpr auto check_released = &QAbstractButton::released; constexpr auto valueChanged = static_cast< void(QSpinBox::*)(int) >(&QSpinBox::valueChanged); auto const update_threshold_v = [this]{ update_threshold(); }; auto const update_threshold_i = [this](int){ update_threshold(); }; auto const update_sum_v = [this]{ update_sum(); }; auto const update_sum_i = [this](int){ update_sum(); }; connect(&method_threshold_, released, [this]{ show_box(threshold_); update_threshold(); }); connect(&method_sum_, released, [this]{ show_box(sum_); update_sum(); }); connect(&threshold_binarize_, valueChanged, update_threshold_i); connect(&threshold_erode_, valueChanged, update_threshold_i); connect(&threshold_subpixel_, check_released, update_threshold_v); connect(&threshold_show_original_, released, update_threshold_v); connect(&threshold_show_binarize_, released, update_threshold_v); connect(&threshold_show_erode_, released, update_threshold_v); connect(&threshold_show_line_, released, update_threshold_v); connect(&sum_min_value_, valueChanged, update_sum_i); connect(&sum_min_sum_, valueChanged, update_sum_i); connect(&sum_subpixel_, check_released, update_sum_v); connect(&sum_show_original_, released, update_sum_v); connect(&sum_show_line_, released, update_sum_v); update_threshold(); update_sum(); }
void mouse_event(mouse_packet_t *packet) { if (packet->mouse_x != old_x || packet->mouse_y != old_y) { /* mouse moved */ if (old_leftbtn || packet->left_btn) { /* the user is dragging something! */ int dx, dy; win_info_t *win = get_top_window(); if (win && (drag_x != -1 || ( (int) old_x >= (int) win->x-4 && (int) old_y >= (int) win->y-22 && (int) old_x < (int) win->x+win->pixbuf->width+8 && (int) old_y < (int) win->y))) { /* the dragging is on the title bar */ if (drag_x == -1) { drag_x = old_x; drag_y = old_y; win_x = win->x; win_y = win->y; } if (last_x != -1) { dx = last_x - drag_x; dy = last_y - drag_y; hide_box(win_x-4 + dx, win_y-22 + dy, win->pixbuf->width+8, win->pixbuf->height+26); } dx = (last_x = packet->mouse_x) - drag_x; dy = (last_y = packet->mouse_y) - drag_y; show_box(win_x-4 + dx, win_y-22 + dy, win->pixbuf->width+8, win->pixbuf->height+26); } } draw_cursor(); } if (!old_leftbtn && packet->left_btn) { /* button pressed */ old_leftbtn = 1; if (drag_x == -1) { win_info_t *top; msg_t msg; wm_event_t event = {0}; /* change focus */ top = change_focus(old_x, old_y); if (top) { /* send event packet */ int rx = old_x - (top->x-4); int ry = old_y - (top->y-22); int close_x = (top->pixbuf->width+8)-26; int close_y = 3; int close_width = 20; int close_height = 16; event.prefix = PREFIX_WINMAN; if (rx >= close_x && ry >= close_y && rx < close_x + close_width && ry < close_y + close_height) { /* close button clicked */ event.type = WMEVENT_CLOSE; } else if (last_click == -1 || packet->time - last_click > 500) { /* simple click */ event.type = WMEVENT_CLICK; } else { /* double click */ event.type = WMEVENT_DOUBLE; } last_click = packet->time; event.id = top->wid; event.data[0] = old_x - top->x; event.data[1] = old_y - top->y; msg.buf = &event; msg.size = sizeof(wm_event_t); send(top->pid, &msg); } } } if (old_leftbtn && !packet->left_btn) { /* button released */ old_leftbtn = 0; if (drag_x != -1) { /* drop */ int dx, dy; win_info_t *win = get_top_window(); if (win) { dx = packet->mouse_x - drag_x; dy = packet->mouse_y - drag_y; win->x = win_x + dx; win->y = win_y + dy; update_screen(); } } last_x = -1; drag_x = -1; } }
void show_activities(void) { /*tex Index into |nest|: */ int p; /*tex The mode: */ int m; /*tex For showing the current page: */ halfword q, r; /*tex Ditto: */ int t; tprint_nl(""); print_ln(); for (p = nest_ptr; p >= 0; p--) { m = nest[p].mode_field; tprint_nl("### "); print_mode(m); tprint(" entered at line "); print_int(abs(nest[p].ml_field)); if (nest[p].ml_field < 0) tprint(" (\\output routine)"); if (p == 0) { /*tex Show the status of the current page */ if (page_head != page_tail) { tprint_nl("### current page:"); if (output_active) tprint(" (held over for next output)"); show_box(vlink(page_head)); if (page_contents > empty) { tprint_nl("total height "); print_totals(); tprint_nl(" goal height "); print_scaled(page_goal); r = vlink(page_ins_head); while (r != page_ins_head) { print_ln(); tprint_esc("insert"); t = subtype(r); print_int(t); tprint(" adds "); if (count(t) == 1000) t = height(r); else t = x_over_n(height(r), 1000) * count(t); print_scaled(t); if (type(r) == split_up_node) { q = page_head; t = 0; do { q = vlink(q); if ((type(q) == ins_node) && (subtype(q) == subtype(r))) incr(t); } while (q != broken_ins(r)); tprint(", #"); print_int(t); tprint(" might split"); } r = vlink(r); } } } if (vlink(contrib_head) != null) tprint_nl("### recent contributions:"); } show_box(vlink(nest[p].head_field)); /*tex Show the auxiliary field, |a|. */ switch (abs(m) / (max_command_cmd + 1)) { case 0: tprint_nl("prevdepth "); if (nest[p].prev_depth_field <= ignore_depth) tprint("ignored"); else print_scaled(nest[p].prev_depth_field); if (nest[p].pg_field != 0) { tprint(", prevgraf "); print_int(nest[p].pg_field); if (nest[p].pg_field != 1) tprint(" lines"); else tprint(" line"); } break; case 1: tprint_nl("spacefactor "); print_int(nest[p].space_factor_field); break; case 2: if (nest[p].incompleat_noad_field != null) { tprint("this will be denominator of:"); show_box(nest[p].incompleat_noad_field); } break; } } }
void tex::show_activities () { int a; int m; list *p; *nest_ptr = cur_list; print_nl(null_str); print_ln(); for (p = nest_ptr; p >= nest; decr(p)) { m = p->mode_field; a = p->aux_field; print_nl("### "); print_mode(m); print(" entered at line "); print_int(abs(p->ml_field)); if (m == HMODE) { if (p->lhm_field != 2 || p->rhm_field != 3) { print(" (hyphenmin "); print_int(p->lhm_field); print(","); print_int(p->rhm_field); print(")"); } } if (p->ml_field < 0) { print(" (\\output routine)"); } if (p == nest) { show_cur_page(); if (link(contrib_head) != null) print_nl("### recent contributions:"); } show_box(link(p->head_field)); switch (abs(m) / (MAX_COMMAND + 1)) { case 0: print_nl("prevdepth "); if (a <= IGNORE_DEPTH) { print("ignored"); } else { print_scaled(a); } if (p->pg_field != 0) { print(", prevgraf "); print_int(p->pg_field); print(" line"); if (p->pg_field != 1) print("s"); } break; case 1: print_nl("spacefactor "); print_int(a); if (m > 0 && p->clang_field > 0) { print(", current language "); print_int(p->clang_field); } break; case 2: if (a != null) { print_nl("this will be denominator of:"); show_box(a); } break; } } }
void do_page(const month_grid& m, bool left_half, bool right_half) { s_ps->black(); s_ps->font("Arial", 10); // s_ps->rectangle(X0, X0 + WIDTH, Y0, Y0 + HEIGHT); set_box(X0, RIGHT, Y0, TOP); thinline(); show_box(); // Line down the middle. vrule(X0 + WIDTH / 2); float column_width = WIDTH / 8; // Top row: day names. float top_row_height = 20; // Title. if (right_half) { // Right column; title & notes. float x = X0 + WIDTH - column_width; vrule(x); s_ps->printf(x + 10, s_y1 - 20, m.m_month_name); s_ps->printf(x + 10, s_y1 - 40, "%d", m.m_year); } if (left_half) { // Mini-title, for double-checking book layout. s_ps->printf(X0 + WIDTH / 2 - 90, s_y0 + 3, "%s %d", m.m_month_name, m.m_year); } for (int i = 0; i < 7; i++) { if (left_half == false && i < 4) continue; if (right_half == false && i >= 4) continue; static const char* day_name[7] = { "SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY" }; float x = X0 + column_width * i; set_box(x, x + column_width, TOP - top_row_height, TOP); s_ps->gray(0.75f); fill_box(); s_ps->black(); show_box(); s_ps->font("Arial", 8); s_ps->printf(x + 5, TOP - top_row_height + 3, day_name[i]); } float row_height = (HEIGHT - top_row_height) / ROWS; // Days. for (int row = 0; row < ROWS; row++) { for (int col = 0; col < COLS; col++) { if (left_half == false && col < 4) continue; if (right_half == false && col >= 4) continue; int day_number = m.m_day_number[row][col]; if (day_number == 0) { // Not a day. continue; } // Show this day. float x = X0 + column_width * col; float y = Y0 + row_height * (ROWS - 1 - row); set_box(x, x + column_width, y, y + row_height); thickline(); show_box(); // Show lines. static const int LINES = 8; float line_height = row_height / LINES; for (int line = 0; line < LINES; line++) { thinline(); hrule(y + line_height * line); } // Show the day number. s_ps->printf(s_x1 - 11, s_y0 + 3, "%2d", day_number); } } }