(* This file is part of Templot1, a computer program for the design of model railway track. Copyright (C) 2018, 2021 Martin Wynne. email: martin@85a.uk This program is free software: you may redistribute it and/or modify it under the terms of the GNU General Public Licence as published by the Free Software Foundation, either version 3 of the Licence, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public Licence for more details. You should have received a copy of the GNU General Public Licence along with this program. See the file: licence.txt Or if not, refer to the web site: https://www.gnu.org/licenses/ ================================================================================ This file was saved from Delphi5 This file was derived from Templot2 version 227d *) unit dtp_settings_unit; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, Menus, Clipbrd, ImgList, dtpDocument, dtpPage, dtpShape, dtpTextShape, dtpExposedMetafile, ExtDlgs, dtpGr32, sdOptionRefs, Printers, dtpEffectShape, dtpColoreffects, dtpShadowEffects, dtpBitmapShape, dtpRasterFormats, dtpFreehandShape, ShellApi, dtpPolygonShape, dtpMemoShape, dtpLineShape, dtpResource, dtpRasterHCK, dtpPolygonText, dtpProjectiveText, dtpTextureEffects, dtpDefaults, dtpNativeXml, dtpTestProcedures, frmHistogram, dtpHandles, rsRuler, dtpW2K3Handles, Math, dtpCropBitmap, VirtualScrollbox, Jpeg, dtpRasterGIF, CheckLst, Buttons, RVStyle, RVScroll, RichView, arc_shape_unit, Htmlview; type Tdtp_settings_form = class(TForm) dtp_settings_panel: TPanel; control_panel_page_control: TPageControl; add_tab_sheet: TTabSheet; add_item_top_panel: TPanel; add_item_title_label: TLabel; modify_item_tab_sheet: TTabSheet; page_tab_sheet: TTabSheet; page_top_panel: TPanel; page_title_label: TLabel; margins_groupbox: TGroupBox; margin_left_label: TLabel; margin_top_label: TLabel; margin_right_label: TLabel; margin_bottom_label: TLabel; margin_left_edit: TEdit; margin_top_edit: TEdit; margin_right_edit: TEdit; margin_bottom_edit: TEdit; guide_lines_groupbox: TGroupBox; guide_spacing_label: TLabel; guide_line_spacing_edit: TEdit; settings_tab_sheet: TTabSheet; options_top_panel: TPanel; settings_title_label: TLabel; multi_select_radiogroup: TRadioGroup; show_on_pad_groupbox: TGroupBox; render_trackplan_on_pad_checkbox: TCheckBox; pad_transfer_mode_groupbox: TGroupBox; transfer_mode_low_res_radiobutton: TRadioButton; transfer_mode_hi_res_radiobutton: TRadioButton; sb_use_pad_colour_checkbox: TCheckBox; modify_top_panel: TPanel; edit_title_label: TLabel; polygon_groupbox: TGroupBox; outline_width_label: TLabel; fill_transparency_label: TLabel; alpha_fill_label: TLabel; outline_width_edit: TEdit; fill_transparency_trackbar: TTrackBar; outline_colour_label: TLabel; infill_colour_label: TLabel; separator_shape1: TShape; metafile_groupbox: TGroupBox; replace_line_colour_label: TLabel; metafile_replace_line_width_label: TLabel; replace_fill_colour_label: TLabel; replace_style_label: TLabel; replace_width_dots_label: TLabel; emf_replace_pen_checkbox: TCheckBox; metafile_pen_width_edit: TEdit; emf_replace_brush_checkbox: TCheckBox; emf_replace_brush_combo: TComboBox; separator_shape2: TShape; font_groupbox: TGroupBox; font_colour_label: TLabel; font_height_label: TLabel; font_mm_label: TLabel; font_name_label: TLabel; font_name_combo: TComboBox; font_height_mm_edit: TEdit; bold_checkbox: TCheckBox; italic_checkbox: TCheckBox; underline_checkbox: TCheckBox; strikeout_checkbox: TCheckBox; text_groupbox: TGroupBox; one_line_text_label: TLabel; alignment_label: TLabel; single_line_text_edit: TEdit; alignment_combo: TComboBox; image_groupbox: TGroupBox; bitmap_file_label: TLabel; save_image_file_button: TButton; line_groupbox: TGroupBox; Label3: TLabel; Label12: TLabel; Label13: TLabel; Label14: TLabel; Label15: TLabel; line_width_edit: TEdit; arrow1_combo: TComboBox; arrow2_combo: TComboBox; edArrow1Width: TEdit; edArrow1Length: TEdit; edArrow2Width: TEdit; edArrow2Length: TEdit; rounded_rectangle_groupbox: TGroupBox; Label6: TLabel; Label7: TLabel; corner_radius_edit: TEdit; dimensions_groupbox: TGroupBox; rotation_label: TLabel; x_edit_label: TLabel; y_edit_label: TLabel; width_edit_label: TLabel; height_edit_label: TLabel; angle_edit: TEdit; x_edit: TEdit; y_edit: TEdit; item_width_edit: TEdit; item_height_edit: TEdit; mirror_checkbox: TCheckBox; flip_checkbox: TCheckBox; keep_aspect_ratio_checkbox: TCheckBox; multi_text_label: TLabel; multi_line_text_ok_button: TButton; multi_line_text_memo: TMemo; model_mm_label: TLabel; mimic_groupbox: TGroupBox; sb_zoom_limit_checkbox: TCheckBox; guide_lines_checkbox: TCheckBox; show_margins_checkbox: TCheckBox; page_size_colour_groupbox: TGroupBox; custom_page_width_label: TLabel; custom_page_height_label: TLabel; page_width_edit: TEdit; page_height_edit: TEdit; page_size_combo: TComboBox; sb_page_colour_panel: TPanel; sb_page_colour_button: TButton; sb_grid_colour_panel: TPanel; sb_grid_colour_button: TButton; portrait_landscape_button: TButton; page_sizes_label: TLabel; page_size_limits_label: TLabel; margins_limit_label: TLabel; guide_lines_limits_label: TLabel; hide_tab_sheet: TTabSheet; sb_outline_colour_panel: TPanel; sb_outline_colour_button: TButton; sb_ok_button: TButton; sb_infill_colour_panel: TPanel; sb_infill_colour_button: TButton; sb_metafile_pen_colour_panel: TPanel; sb_metafile_pen_colour_button: TButton; sb_metafile_brush_colour_panel: TPanel; sb_metafile_brush_colour_button: TButton; sb_font_colour_panel: TPanel; sb_font_colour_button: TButton; trackplan_tab_sheet: TTabSheet; trackplan_top_panel: TPanel; Label23: TLabel; add_trackplan_groupbox: TGroupBox; Label20: TLabel; Label21: TLabel; trackplan_format_groupbox: TGroupBox; bitmap_width_label: TLabel; add_bitmap_trackplan_radiobutton: TRadioButton; add_metafile_trackplan_radiobutton: TRadioButton; trackplan_bitmap_width_edit: TEdit; add_full_page_trackplan_button: TButton; add_dragged_trackplan_button: TButton; allow_track_select_checkbox: TCheckBox; trackplan_options_groupbox: TGroupBox; auto_add_radiobutton: TRadioButton; manual_add_radiobutton: TRadioButton; lock_radiobutton: TRadioButton; lock_size_checkbox: TCheckBox; lock_position_checkbox: TCheckBox; lock_angle_checkbox: TCheckBox; outline_mm_label: TLabel; degrees_label: TLabel; Label25: TLabel; Label26: TLabel; Label27: TLabel; Label28: TLabel; Label29: TLabel; Label30: TLabel; Label31: TLabel; Label32: TLabel; Label33: TLabel; sb_word_wrap_memo_checkbox: TCheckBox; no_delete_checkbox: TCheckBox; curved_text_angle_edit: TEdit; curved_text_angle_label: TLabel; curved_text_degrees_label: TLabel; perspective_text_checkbox: TCheckBox; Label1: TLabel; item_name_edit: TEdit; Label4: TLabel; image_width_pixels_label: TLabel; image_height_pixels_label: TLabel; image_filename_edit: TEdit; Label5: TLabel; Label2: TLabel; Label8: TLabel; Label9: TLabel; Label10: TLabel; Label11: TLabel; Label18: TLabel; blue_corner_panel: TPanel; size_updown: TUpDown; sb_help_button: TButton; xposn_updown: TUpDown; yposn_updown: TUpDown; angle_updown: TUpDown; master_trans_panel: TGroupBox; alpha_master_label: TLabel; master_clear_label: TLabel; master_solid_label: TLabel; master_transparency_trackbar: TTrackBar; outline_only_radio: TRadioButton; outline_and_infill_radio: TRadioButton; infill_only_radio: TRadioButton; manual_add_update_checkbox: TCheckBox; auto_update_diagram_checkbox: TCheckBox; Label35: TLabel; track_metafile_dpi_label: TLabel; dpi_label: TLabel; trackplan_metafile_dpi_edit: TEdit; image_rectangle_groupbox: TGroupBox; draw_export_rectangle_button: TButton; rectangle_clear_button: TButton; rectangle_set_button: TButton; colours_groupbox: TGroupBox; trackplan_colour_radiobutton: TRadioButton; trackplan_grey_radiobutton: TRadioButton; trackplan_black_radiobutton: TRadioButton; manual_add_diagram_checkbox: TCheckBox; trackplan_include_groupbox: TGroupBox; include_all_radiobutton: TRadioButton; include_group_only_radiobutton: TRadioButton; include_control_template_radiobutton: TRadioButton; boundary_groupbox: TGroupBox; trackplan_fit_all_radiobutton: TRadioButton; trackplan_boundary_rectangle_radiobutton: TRadioButton; trackplan_fit_shapes_radiobutton: TRadioButton; update_items_button: TButton; Label24: TLabel; no_update_checkbox: TCheckBox; bitmap_load_dialog: TOpenPictureDialog; metafile_load_dialog: TOpenPictureDialog; snap_to_guides_checkbox: TCheckBox; tab_header_label: TLabel; png_groupbox: TGroupBox; Label55: TLabel; Label56: TLabel; sb_image_width_edit: TEdit; sb_transparent_gif_checkbox: TCheckBox; Label57: TLabel; Label58: TLabel; sb_pdf_emf_dpi_edit: TEdit; Label59: TLabel; Label60: TLabel; Shape1: TShape; Label17: TLabel; Label16: TLabel; Label54: TLabel; update_now_button: TButton; zoom_image_actual_button: TButton; save_bitmap_dialog: TSavePictureDialog; rvf_groupbox: TGroupBox; edit_rvf_button: TButton; rvf_scrollbox: TScrollBox; modify_tab_rich_view: TRichView; Label69: TLabel; Label70: TLabel; no_select_checkbox: TCheckBox; quality_groupbox: TGroupBox; print_quality_label: TLabel; print_quality_dropdown: TComboBox; design_quality_radiobutton: TRadioButton; display_quality_radiobutton: TRadioButton; Label19: TLabel; quality_help_button: TButton; include_groupbox: TGroupBox; include_grid_checkbox: TCheckBox; include_grid_labels_checkbox: TCheckBox; include_picture_shapes_checkbox: TCheckBox; include_picture_borders_checkbox: TCheckBox; Label73: TLabel; emf_replace_pen_combo: TComboBox; Label74: TLabel; Label75: TLabel; track_background_checkbox: TCheckBox; raster_trackplan_bgnd_checkbox: TCheckBox; match_track_bgnd_button: TButton; internal_dpi_label: TLabel; render_dpi_edit: TEdit; dpi_locked_checkbox: TCheckBox; include_in_output_groupbox: TGroupBox; render_trackplan_in_output_checkbox: TCheckBox; include_track_checkbox: TCheckBox; include_trackplan_help_button: TButton; show_on_trackpad_help_button: TButton; Label79: TLabel; sb_reduced_output_res_width_edit: TEdit; render_output_reduced_resolution_radiobutton: TRadioButton; render_output_full_resolution_radiobutton: TRadioButton; Label77: TLabel; Label78: TLabel; match_trackpad_colour_button: TButton; rvf_bgnd_shape: TShape; ring_arc_groupbox: TGroupBox; Label80: TLabel; Label82: TLabel; ring_inner_dia_edit: TEdit; Label81: TLabel; full_sector_label: TLabel; edit_polygon_groupbox: TGroupBox; outline_edit_button: TButton; Shape2: TShape; Label83: TLabel; quadrangle_groupbox: TGroupBox; Label84: TLabel; Label85: TLabel; Label86: TLabel; quadrangle_inner_edit: TEdit; cap_groupbox: TGroupBox; Label87: TLabel; Label88: TLabel; Label89: TLabel; cap_inner_edit: TEdit; cap_left_radio: TRadioButton; cap_top_radio: TRadioButton; cap_right_radio: TRadioButton; cap_bottom_radio: TRadioButton; Label90: TLabel; cap_closed_radio: TRadioButton; undo_edits_button: TButton; re_frame_button: TButton; add_item_page_control: TPageControl; geometric_tab_sheet: TTabSheet; freehand_tab_sheet: TTabSheet; text_tab_sheet: TTabSheet; image_tab_sheet: TTabSheet; custom_tab_sheet: TTabSheet; add_custom_button: TButton; Label22: TLabel; Label71: TLabel; Label76: TLabel; Label39: TLabel; Label62: TLabel; Label63: TLabel; Label64: TLabel; Label65: TLabel; Label66: TLabel; Label67: TLabel; freehand_tracking_whats_this_label: TLabel; Label41: TLabel; freehand_tracking_edit: TEdit; polygon_line_width_edit: TEdit; freehand_line_width_edit: TEdit; freehand_info_button: TButton; rectangle_bitbutton: TBitBtn; round_rect_bitbutton: TBitBtn; elipse_bitbutton: TBitBtn; square_bitbutton: TBitBtn; quadrangle_bitbutton: TBitBtn; circle_bitbutton: TBitBtn; segment_bitbutton: TBitBtn; enclosure_bitbutton: TBitBtn; ring_bitbutton: TBitBtn; arc_bitbutton: TBitBtn; triangle_bitbutton: TBitBtn; arrow_bitbutton: TBitBtn; line_bitbutton: TBitBtn; corner_bitbutton: TBitBtn; corner_flip_label: TLabel; both_html_view: THTMLViewer; more_bitbutton: TBitBtn; free_lines_bitbutton: TBitBtn; free_polygon_bitbutton: TBitBtn; square_polygon_bitbutton: TBitBtn; free_patch_bitbutton: TBitBtn; freehand_html_view: THTMLViewer; polygon_html_view: THTMLViewer; Label34: TLabel; Label40: TLabel; Label42: TLabel; single_text_bitbutton: TBitBtn; multi_text_bitbutton: TBitBtn; formatted_text_bitbutton: TBitBtn; Label45: TLabel; Label48: TLabel; wavy_text_bitbutton: TBitBtn; curved_text_bitbutton: TBitBtn; distorted_text_bitbutton: TBitBtn; Label36: TLabel; Label52: TLabel; Label53: TLabel; more_text_info_button: TButton; image_bitbutton: TBitBtn; metafile_bitbutton: TBitBtn; paste_image_bitbutton: TBitBtn; Label37: TLabel; Label100: TLabel; Label91: TLabel; geometric_html_view: THTMLViewer; formatted_text_html_view: THTMLViewer; plain_text_html_view: THTMLViewer; fancy_text_html_view: THTMLViewer; curved_text_negative_label: TLabel; sb_wmf_radiobutton: TRadioButton; sb_emf_radiobutton: TRadioButton; Label38: TLabel; image_file_html_view: THTMLViewer; pasted_image_html_view: THTMLViewer; metafile_html_view: THTMLViewer; add_custom_html_view: THTMLViewer; outline_help_button: TButton; trackplan_colours_label: TLabel; scan_image_bitbutton: TBitBtn; Label44: TLabel; Label43: TLabel; open_mystuff_button: TButton; Label46: TLabel; jpg_quality_button: TButton; Label47: TLabel; width_updown: TUpDown; depth_updown: TUpDown; mimic_label: TLabel; mimic_button: TButton; mimic_info_button: TButton; do_export_rectangle_button: TButton; metafile_data_groupbox: TGroupBox; metafile_data_memo: TMemo; set_boundary_rectangle_button: TButton; ref_checkbox: TCheckBox; include_symbols_checkbox: TCheckBox; procedure FormCreate(Sender: TObject); procedure page_size_comboChange(Sender: TObject); procedure print_quality_dropdownChange(Sender: TObject); procedure render_dpi_editExit(Sender: TObject); procedure page_width_editExit(Sender: TObject); procedure page_height_editExit(Sender: TObject); procedure margin_left_editExit(Sender: TObject); procedure margin_top_editExit(Sender: TObject); procedure margin_right_editExit(Sender: TObject); procedure margin_bottom_editExit(Sender: TObject); procedure guide_line_spacing_editExit(Sender: TObject); procedure multi_select_radiogroupClick(Sender: TObject); procedure add_bitmap_trackplan_radiobuttonClick(Sender: TObject); procedure add_metafile_trackplan_radiobuttonClick(Sender: TObject); procedure add_full_page_trackplan_buttonClick(Sender: TObject); procedure add_dragged_trackplan_buttonClick(Sender: TObject); procedure guide_lines_checkboxClick(Sender: TObject); procedure show_margins_checkboxClick(Sender: TObject); procedure master_transparency_trackbarChange(Sender: TObject); procedure angle_editExit(Sender: TObject); procedure x_editExit(Sender: TObject); procedure item_width_editExit(Sender: TObject); procedure item_height_editExit(Sender: TObject); procedure font_name_comboChange(Sender: TObject); procedure font_height_mm_editExit(Sender: TObject); procedure bold_checkboxClick(Sender: TObject); procedure italic_checkboxClick(Sender: TObject); procedure underline_checkboxClick(Sender: TObject); procedure strikeout_checkboxClick(Sender: TObject); procedure single_line_text_editExit(Sender: TObject); procedure alignment_comboChange(Sender: TObject); procedure mirror_checkboxClick(Sender: TObject); procedure flip_checkboxClick(Sender: TObject); procedure emf_replace_pen_checkboxClick(Sender: TObject); procedure emf_replace_brush_checkboxClick(Sender: TObject); procedure emf_replace_brush_comboChange(Sender: TObject); procedure metafile_pen_width_editExit(Sender: TObject); procedure keep_aspect_ratio_checkboxClick(Sender: TObject); procedure save_image_file_buttonClick(Sender: TObject); procedure fill_transparency_trackbarChange(Sender: TObject); procedure outline_width_editExit(Sender: TObject); procedure multi_line_text_memoExit(Sender: TObject); procedure line_width_editExit(Sender: TObject); procedure arrow1_comboChange(Sender: TObject); procedure arrow2_comboChange(Sender: TObject); procedure edArrow1WidthExit(Sender: TObject); procedure edArrow2WidthExit(Sender: TObject); procedure edArrow1LengthExit(Sender: TObject); procedure edArrow2LengthExit(Sender: TObject); procedure corner_radius_editExit(Sender: TObject); procedure curved_text_angle_editExit(Sender: TObject); procedure perspective_text_checkboxClick(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure FormResize(Sender: TObject); procedure FormKeyDown(Sender:TObject; var Key:Word; Shift:TShiftState); procedure multi_line_text_ok_buttonClick(Sender: TObject); procedure manual_add_radiobuttonClick(Sender: TObject); procedure auto_add_radiobuttonClick(Sender: TObject); procedure include_grid_checkboxClick(Sender: TObject); procedure include_grid_labels_checkboxClick(Sender: TObject); procedure lock_radiobuttonClick(Sender: TObject); procedure include_picture_shapes_checkboxClick(Sender: TObject); procedure sb_page_colour_buttonClick(Sender: TObject); procedure sb_grid_colour_buttonClick(Sender: TObject); procedure portrait_landscape_buttonClick(Sender: TObject); procedure page_tab_sheetShow(Sender: TObject); procedure sb_outline_colour_buttonClick(Sender: TObject); procedure hide_tab_sheetShow(Sender: TObject); procedure sb_ok_buttonClick(Sender: TObject); procedure settings_tab_sheetShow(Sender: TObject); procedure modify_item_tab_sheetShow(Sender: TObject); procedure add_tab_sheetShow(Sender: TObject); procedure sb_infill_colour_buttonClick(Sender: TObject); procedure sb_metafile_pen_colour_buttonClick(Sender: TObject); procedure sb_metafile_brush_colour_buttonClick(Sender: TObject); procedure sb_font_colour_buttonClick(Sender: TObject); procedure trackplan_tab_sheetShow(Sender: TObject); procedure sb_word_wrap_memo_checkboxClick(Sender: TObject); procedure size_updownClick(Sender: TObject; Button: TUDBtnType); procedure xposn_updownClick(Sender: TObject; Button: TUDBtnType); procedure yposn_updownClick(Sender: TObject; Button: TUDBtnType); procedure angle_updownClick(Sender: TObject; Button: TUDBtnType); procedure outline_only_radioClick(Sender: TObject); procedure lock_position_checkboxClick(Sender: TObject); procedure lock_size_checkboxClick(Sender: TObject); procedure lock_angle_checkboxClick(Sender: TObject); procedure no_delete_checkboxClick(Sender: TObject); procedure auto_update_diagram_checkboxClick(Sender: TObject); procedure manual_add_update_checkboxClick(Sender: TObject); procedure rectangle_set_buttonClick(Sender: TObject); procedure manual_add_diagram_checkboxClick(Sender: TObject); procedure update_items_buttonClick(Sender: TObject); procedure no_update_checkboxClick(Sender: TObject); procedure item_name_editExit(Sender: TObject); procedure sb_help_buttonClick(Sender: TObject); procedure freehand_tracking_editExit(Sender: TObject); procedure snap_to_guides_checkboxClick(Sender: TObject); procedure FormMouseWheelDown(Sender: TObject; Shift: TShiftState; MousePos: TPoint; var Handled: Boolean); procedure FormMouseWheelUp(Sender: TObject; Shift: TShiftState; MousePos: TPoint; var Handled: Boolean); procedure update_now_buttonClick(Sender: TObject); procedure polygon_line_width_editExit(Sender: TObject); procedure freehand_line_width_editExit(Sender: TObject); procedure draw_export_rectangle_buttonClick(Sender: TObject); procedure rectangle_clear_buttonClick(Sender: TObject); procedure zoom_image_actual_buttonClick(Sender: TObject); procedure edit_rvf_buttonClick(Sender: TObject); procedure add_custom_buttonClick(Sender: TObject); procedure no_select_checkboxClick(Sender: TObject); procedure freehand_tracking_whats_this_labelClick(Sender: TObject); procedure page_size_comboKeyPress(Sender: TObject; var Key: Char); procedure emf_replace_pen_comboChange(Sender: TObject); procedure match_track_bgnd_buttonClick(Sender: TObject); procedure match_trackpad_colour_buttonClick(Sender: TObject); procedure ring_inner_dia_editExit(Sender: TObject); procedure outline_edit_buttonClick(Sender: TObject); procedure marker_shape_changed(Sender:TObject); procedure quadrangle_inner_editExit(Sender: TObject); procedure cap_inner_editExit(Sender: TObject); procedure cap_left_radioClick(Sender: TObject); procedure cap_top_radioClick(Sender: TObject); procedure cap_bottom_radioClick(Sender: TObject); procedure cap_right_radioClick(Sender: TObject); procedure cap_closed_radioClick(Sender: TObject); procedure undo_edits_buttonClick(Sender: TObject); procedure re_frame_buttonClick(Sender: TObject); procedure corner_bitbuttonClick(Sender: TObject); procedure round_rect_bitbuttonClick(Sender: TObject); procedure arrow_bitbuttonClick(Sender: TObject); procedure rectangle_bitbuttonClick(Sender: TObject); procedure segment_bitbuttonClick(Sender: TObject); procedure quadrangle_bitbuttonClick(Sender: TObject); procedure arc_bitbuttonClick(Sender: TObject); procedure triangle_bitbuttonClick(Sender: TObject); procedure enclosure_bitbuttonClick(Sender: TObject); procedure ring_bitbuttonClick(Sender: TObject); procedure circle_bitbuttonClick(Sender: TObject); procedure square_bitbuttonClick(Sender: TObject); procedure elipse_bitbuttonClick(Sender: TObject); procedure line_bitbuttonClick(Sender: TObject); procedure more_bitbuttonClick(Sender: TObject); procedure free_patch_bitbuttonClick(Sender: TObject); procedure free_lines_bitbuttonClick(Sender: TObject); procedure free_polygon_bitbuttonClick(Sender: TObject); procedure square_polygon_bitbuttonClick(Sender: TObject); procedure multi_text_bitbuttonClick(Sender: TObject); procedure single_text_bitbuttonClick(Sender: TObject); procedure formatted_text_bitbuttonClick(Sender: TObject); procedure curved_text_bitbuttonClick(Sender: TObject); procedure wavy_text_bitbuttonClick(Sender: TObject); procedure distorted_text_bitbuttonClick(Sender: TObject); procedure image_bitbuttonClick(Sender: TObject); procedure paste_image_bitbuttonClick(Sender: TObject); procedure metafile_bitbuttonClick(Sender: TObject); procedure outline_help_buttonClick(Sender: TObject); procedure scan_image_bitbuttonClick(Sender: TObject); procedure open_mystuff_buttonClick(Sender: TObject); procedure jpg_quality_buttonClick(Sender: TObject); procedure FormShow(Sender: TObject); procedure y_editExit(Sender: TObject); procedure width_updownClick(Sender: TObject; Button: TUDBtnType); procedure depth_updownClick(Sender: TObject; Button: TUDBtnType); procedure mimic_info_buttonClick(Sender: TObject); procedure mimic_buttonClick(Sender: TObject); procedure ref_checkboxClick(Sender: TObject); private { Private declarations } public { Public declarations } end; Tmarker=class(TPersistent) // 212a public line_index:integer; marker_centre:TFloatPoint; marker_shape:TdtpOutlineMarkerShape; end;//class var dtp_settings_form: Tdtp_settings_form; FFillAlpha:cardinal=255; FUseFill:boolean=True; FUseOutline:boolean=True; FFillColor:TColor=$0000C0FF; // sand FOutlineColor:TColor=clBlack; selected_shapes_list:TList; deleted_shapes_list:TStringList; // 205e font_list:TStringList; freehand_line_width:extended=0; // stored as page mm. if 0, use default instead polygon_line_width:extended=0; // stored as page mm. if 0, use default instead sb_tab_sheets_expanded:boolean=False; polygon_shape_now_editing:Tdtp85aPolygonShape=nil; // 212a outline_markers_list:TStringList; sb_marker_size_trackbar_changed:boolean=False; sb_marker_size_is_changing:boolean=False; procedure do_copyright(in_shape:TdtpShape); function AnchorsToDescription(Anchors:TShapeAnchors): string; function sb_check_valid_float(edit_box:TEdit; limit_low,limit_high:extended; var float_val:extended):boolean; // 205e function sb_check_valid_int(edit_box:TEdit; limit_low,limit_high:integer; var int_val:integer):boolean; // 205e procedure page_tab_sheet_update; procedure settings_tab_sheet_update; procedure modify_tab_sheet_update; procedure do_polygon(square:boolean); procedure add_freehand_shape(patch:boolean); procedure sb_modify_markers_size; // 212a change size of markers procedure insert_new_marker; procedure start_new_marker_row; function convert_pagex_to_padx(page_x:extended):extended; function convert_pagey_to_pady(page_y:extended):extended; function convert_pagew_to_padw(page_w:extended):extended; // widths 226e function convert_pageh_to_padh(page_h:extended):extended; // heights 226e procedure add_bitmap_image(dropped_file_str:string); // 214a procedure add_metafile_image(dropped_file_str:string); // 214a function find_reference_item:integer; // 227a //______________________________________________________________________________ implementation uses dtp_unit, sketchboard_unit, pad_unit, alert_unit, help_sheet, control_room, entry_sheet, colour_unit, math_unit, export_unit, grid_unit, print_settings_unit, bgnd_unit, panning_unit, sb_rvf_unit, PNGImage, sb_rvf_outer_unit, edit_outline_unit, keep_select; {$R *.DFM} var no_onresize:boolean=False; his_load_bitmap_path:string=''; his_load_metafile_path:string=''; current_formatted_text_str:string=''; // 0.97.a num_markers_selected:integer; //______________________________________________________________________________ procedure Tdtp_settings_form.FormCreate(Sender: TObject); var i:integer; begin //Parent:=dtp_form; // if Parent set, TEdit controls won't focus with mouse -- dtp captures the mousedown Autoscroll:=False; ClientWidth:=440; ClientHeight:=60; dtp_settings_panel.Width:=ClientWidth; control_panel_page_control.Width:=dtp_settings_panel.Width; print_quality_dropdown.Items.Clear; for i := 0 to cPrintQualityCount-1 do print_quality_dropdown.Items.Add(cPrintQualityNames[i]); page_size_combo.Items.Clear; for i := 0 to cPaperSizeCount-1 do page_size_combo.Items.Add(cPaperSizes[i].Name); control_panel_page_control.ActivePage:=hide_tab_sheet; selected_shapes_list:=TList.Create; deleted_shapes_list:=TStringList.Create; // 205e font_list:=TStringList.Create; font_list.Text:=Screen.Fonts.Text; // 205e added font_name_combo.Items.Assign(font_list); // 205e added (was in OnDropDown) outline_markers_list:=TStringList.Create; // 212a // relocate at run time... font_groupbox.Left:=4; text_groupbox.Left:=4; line_groupbox.Left:=4; image_groupbox.Left:=4; rounded_rectangle_groupbox.Left:=4; rvf_groupbox.Left:=4; ring_arc_groupbox.Left:=4; // 212a quadrangle_groupbox.Left:=4; // 212a cap_groupbox.Left:=4; // 212a edit_polygon_groupbox.Left:=262; // 212a metafile_data_groupbox.Left:=4; // 227a metafile_groupbox.Top:=32; image_groupbox.Top:=32; line_groupbox.Top:=186; rvf_groupbox.Top:=186; ring_arc_groupbox.Top:=186; // 212a quadrangle_groupbox.Top:=186; // 212a cap_groupbox.Top:=186; // 212a edit_polygon_groupbox.Top:=186; // 212a metafile_data_groupbox.Top:=186; // 227a arrow1_combo.ItemIndex:=0; arrow2_combo.ItemIndex:=0; // 226e .. mimic_label.Caption:=insert_crlf_str('1. create an export boundary rectangle enclosing the track| area on the trackpad which you want to use for a mimic| control panel or signal box diagram.' +'||2. set the sketchboard page size in the top boxes above.' +'||3. then click:'); end; //______________________________________________________________________________ function sb_check_valid_float(edit_box:TEdit; limit_low,limit_high:extended; var float_val:extended):boolean; // check valid float dimension entered in sketchboard TEdit boxes... var str:string; begin RESULT:=False; // init if edit_box.Text='' // allow empty box then begin if limit_low<0 then edit_box.Text:='0' else edit_box.Text:=round_str(limit_low,1); end; str:=edit_box.Text; str:=StringReplace(str,'[',' ',[rfReplaceAll, rfIgnoreCase]); // negative brackets to spaces str:=StringReplace(str,']',' ',[rfReplaceAll, rfIgnoreCase]); // negative brackets to spaces str:=Trim(str); try float_val:=StrToFloat(str); // return as var except edit_box.Color:=$00CCAAFF; // pale red if edit_box.Visible=True then edit_box.SetFocus; EXIT; end;//try if (float_vallimit_high) then begin edit_box.Color:=$0055FFFF; // pale yellow caution if edit_box.Visible=True then edit_box.SetFocus; EXIT; end; edit_box.Color:=clWhite; RESULT:=True; end; //______________________________________________________________________________ function sb_check_valid_int(edit_box:TEdit; limit_low,limit_high:integer; var int_val:integer):boolean; // check valid integer dimension entered in sketchboard TEdit boxes... var str:string; begin RESULT:=False; // init if edit_box.Text='' // allow empty box = zero or min then begin if limit_low<0 then edit_box.Text:='0' else edit_box.Text:=IntToStr(limit_low); end; str:=edit_box.Text; str:=StringReplace(str,'[',' ',[rfReplaceAll, rfIgnoreCase]); // negative brackets to spaces str:=StringReplace(str,']',' ',[rfReplaceAll, rfIgnoreCase]); // negative brackets to spaces str:=Trim(str); try int_val:=StrToInt(str); // return as var except edit_box.Color:=$00CCAAFF; // pale red if edit_box.Visible=True then edit_box.SetFocus; EXIT; end;//try if (int_vallimit_high) then begin edit_box.Color:=$0055FFFF; // pale yellow caution if edit_box.Visible=True then edit_box.SetFocus; EXIT; end; edit_box.Color:=clWhite; RESULT:=True; end; //______________________________________________________________________________ procedure page_tab_sheet_update; var page_width,page_height:extended; begin with dtp_settings_form do begin page_width:=dtp_form.dtp_document.CurrentPage.PageWidth; page_height:=dtp_form.dtp_document.CurrentPage.PageHeight; with page_width_edit do if NOT Focused then Text:=round_str(page_width,2); with page_height_edit do if NOT Focused then Text:=round_str(page_height,2); with page_size_combo do if NOT Focused then ItemIndex:=page_combo_index_from_size(page_width,page_height); sb_page_colour_panel.Color:=dtp_form.dtp_document.CurrentPage.PageColor; show_margins_checkbox.Checked:=dtp_form.dtp_document.ShowMargins; // entire document, not current page with margin_top_edit do if NOT Focused then Text:= round_str(dtp_form.dtp_document.CurrentPage.MarginTop,2); with margin_left_edit do if NOT Focused then Text:= round_str(dtp_form.dtp_document.CurrentPage.MarginLeft,2); with margin_right_edit do if NOT Focused then Text:= round_str(dtp_form.dtp_document.CurrentPage.MarginRight,2); with margin_bottom_edit do if NOT Focused then Text:=round_str(dtp_form.dtp_document.CurrentPage.MarginBottom,2); guide_lines_checkbox.Checked:=(dtp_form.dtp_document.HelperMethod=hmGrid); // entire document, not current page with guide_line_spacing_edit do if NOT Focused then Text:=round_str(dtp_form.dtp_document.CurrentPage.GridSize,2); sb_grid_colour_panel.Color:=dtp_form.dtp_document.CurrentPage.GridColor; snap_to_guides_checkbox.Checked:=dtp_form.dtp_document.SnapToGrid; end;//with end; //______________________________________________________________________________ procedure settings_tab_sheet_update; begin with dtp_settings_form do begin with render_dpi_edit do if NOT Focused then Text:=IntToStr(round(dtp_form.dtp_document.RenderDPI)); with print_quality_dropdown do if NOT Focused then ItemIndex:=integer(dtp_form.dtp_document.PrintQuality); with multi_select_radiogroup do if NOT Focused then ItemIndex:=integer(dtp_form.dtp_document.MultiSelectMethod); end; end; //______________________________________________________________________________ procedure Tdtp_settings_form.page_size_comboChange(Sender:TObject); var APaperSize:TPaperSizeInfoRec; begin with dtp_form do begin if updating_now=True then EXIT; if not assigned(dtp_document.CurrentPage) then EXIT; // avoid invalid or custom index.. if (page_size_combo.ItemIndex<0) or (page_size_combo.ItemIndex>=cPaperSizeCount-1) then EXIT; APaperSize:=cPaperSizes[page_size_combo.ItemIndex]; dtp_document.CurrentPage.PageWidth:=APaperSize.Width; dtp_document.CurrentPage.PageHeight:=APaperSize.Height; end;//with end; //______________________________________________________________________________ procedure Tdtp_settings_form.print_quality_dropdownChange(Sender:TObject); begin with dtp_form do begin if updating_now=True then EXIT; if (print_quality_dropdown.ItemIndex<0) or (print_quality_dropdown.ItemIndex>print_quality_dropdown.Items.Count-1) then EXIT; dtp_document.PrintQuality:=TPrintQualityType(print_quality_dropdown.ItemIndex); end;//with end; //______________________________________________________________________________ procedure Tdtp_settings_form.portrait_landscape_buttonClick(Sender: TObject); var temp:single; begin with dtp_form do begin if updating_now=True then EXIT; with dtp_document do begin if not assigned(CurrentPage) then EXIT; // swap width and height... temp:=CurrentPage.PageWidth; CurrentPage.PageWidth:=CurrentPage.PageHeight; CurrentPage.PageHeight:=temp; end;//with end;//with end; //______________________________________________________________________________ procedure Tdtp_settings_form.sb_grid_colour_buttonClick(Sender: TObject); var colour:TColor; begin if updating_now=True then EXIT; if not assigned(dtp_form.dtp_document.CurrentPage) then EXIT; colour:=sb_grid_colour_panel.Color; colour:=get_colour('choose a colour for the sketchboard guide lines',colour); dtp_form.dtp_document.CurrentPage.GridColor:=colour; sb_grid_colour_panel.Color:=colour; end; //______________________________________________________________________________ procedure Tdtp_settings_form.sb_page_colour_buttonClick(Sender: TObject); begin if updating_now=True then EXIT; if not assigned(dtp_form.dtp_document.CurrentPage) then EXIT; sb_page_colour_panel.Color:=get_colour('choose a background colour for the sketchboard page',sb_page_colour_panel.Color); dtp_form.dtp_document.CurrentPage.PageColor:=sb_page_colour_panel.Color; end; //______________________________________________________________________________ procedure Tdtp_settings_form.match_trackpad_colour_buttonClick(Sender: TObject); begin if updating_now=True then EXIT; if not assigned(dtp_form.dtp_document.CurrentPage) then EXIT; sb_page_colour_panel.Color:=paper_colour; dtp_form.dtp_document.CurrentPage.PageColor:=sb_page_colour_panel.Color; end; //______________________________________________________________________________ procedure Tdtp_settings_form.guide_line_spacing_editExit(Sender:TObject); var box_value:extended; begin with dtp_form do begin if updating_now=True then EXIT; if not assigned(dtp_document.CurrentPage) then EXIT; if sb_check_valid_float(guide_line_spacing_edit,5,250,box_value)=False then EXIT; // invalid input limits 5mm - 250mm dtp_document.CurrentPage.GridSize:=box_value; end;//with end; //______________________________________________________________________________ procedure Tdtp_settings_form.margin_bottom_editExit(Sender:TObject); var box_value:extended; begin with dtp_form do begin if updating_now=True then EXIT; if not assigned(dtp_document.CurrentPage) then EXIT; if sb_check_valid_float(margin_bottom_edit,0.5,100,box_value)=False then EXIT; // invalid input limits 0.5mm - 100mm dtp_document.CurrentPage.MarginBottom:=box_value; end;//with end; //______________________________________________________________________________ procedure Tdtp_settings_form.margin_left_editExit(Sender:TObject); var box_value:extended; begin with dtp_form do begin if updating_now=True then EXIT; if not assigned(dtp_document.CurrentPage) then EXIT; if sb_check_valid_float(margin_left_edit,0.5,100,box_value)=False then EXIT; // invalid input limits 0.5mm - 100mm dtp_document.CurrentPage.MarginLeft:=box_value; end;//with end; //______________________________________________________________________________ procedure Tdtp_settings_form.margin_right_editExit(Sender:TObject); var box_value:extended; begin with dtp_form do begin if updating_now=True then EXIT; if not assigned(dtp_document.CurrentPage) then EXIT; if sb_check_valid_float(margin_right_edit,0.5,100,box_value)=False then EXIT; // invalid input limits 0.5mm - 100mm dtp_document.CurrentPage.MarginRight:=box_value; end;//with end; //______________________________________________________________________________ procedure Tdtp_settings_form.margin_top_editExit(Sender:TObject); var box_value:extended; begin with dtp_form do begin if updating_now=True then EXIT; if not assigned(dtp_document.CurrentPage) then EXIT; if sb_check_valid_float(margin_top_edit,0.5,100,box_value)=False then EXIT; // invalid input limits 0.5mm - 100mm dtp_document.CurrentPage.MarginTop:=box_value; end;//with end; //______________________________________________________________________________ procedure Tdtp_settings_form.page_width_editExit(Sender:TObject); var box_value:extended; begin with dtp_form do begin if updating_now=True then EXIT; if not assigned(dtp_document.CurrentPage) then EXIT; if sb_check_valid_float(page_width_edit,50,10000,box_value)=False then EXIT; // invalid input limits 50mm - 10 metres dtp_document.CurrentPage.PageWidth:=box_value; // set combo to match, or "custom"... page_size_combo.ItemIndex:=page_combo_index_from_size(dtp_document.CurrentPage.PageWidth,dtp_document.CurrentPage.PageHeight); end;//with end; //______________________________________________________________________________ procedure Tdtp_settings_form.page_height_editExit(Sender:TObject); var box_value:extended; begin with dtp_form do begin if updating_now=True then EXIT; if not assigned(dtp_document.CurrentPage) then EXIT; if sb_check_valid_float(page_height_edit,50,10000,box_value)=False then EXIT; // invalid input limits 50mm - 10 metres dtp_document.CurrentPage.PageHeight:=box_value; // set combo to match, or "custom"... page_size_combo.ItemIndex:=page_combo_index_from_size(dtp_document.CurrentPage.PageWidth,dtp_document.CurrentPage.PageHeight); end;//with end; //______________________________________________________________________________ procedure Tdtp_settings_form.render_dpi_editExit(Sender:TObject); var box_value:extended; begin with dtp_form do begin if updating_now=True then EXIT; if not assigned(dtp_document) then EXIT; if sb_check_valid_float(render_dpi_edit,20,10000,box_value)=False then EXIT; // invalid input limits 20dpi - 10000dpi dtp_document.RenderDPI:=box_value; end;//with end; //______________________________________________________________________________ procedure Tdtp_settings_form.multi_select_radiogroupClick(Sender:TObject); begin with dtp_form do begin if updating_now=True then EXIT; dtp_document.MultiSelectMethod:=TMultiSelectMethodType(dtp_settings_form.multi_select_radiogroup.ItemIndex); //UpdateTabs; end;//with end; //______________________________________________________________________________ procedure Tdtp_settings_form.add_bitmap_trackplan_radiobuttonClick(Sender:TObject); begin trackplan_metafile_dpi_edit.Enabled:=False; trackplan_bitmap_width_edit.Enabled:=True; raster_trackplan_bgnd_checkbox.Enabled:=True; end; //______________________________________________________________________________ procedure Tdtp_settings_form.add_metafile_trackplan_radiobuttonClick(Sender:TObject); begin trackplan_metafile_dpi_edit.Enabled:=True; trackplan_bitmap_width_edit.Enabled:=False; raster_trackplan_bgnd_checkbox.Enabled:=False; end; //______________________________________________________________________________ procedure Tdtp_settings_form.add_full_page_trackplan_buttonClick(Sender: TObject); begin if add_metafile_trackplan_radiobutton.Checked=True then add_sb_track_plan_metafile(False,False) else add_sb_track_plan_bitmap(False); end; //______________________________________________________________________________ procedure Tdtp_settings_form.add_dragged_trackplan_buttonClick(Sender: TObject); begin if add_metafile_trackplan_radiobutton.Checked=True then add_sb_track_plan_metafile(True,False) else add_sb_track_plan_bitmap(True); end; //______________________________________________________________________________ procedure shrink_tab_sheets; begin with dtp_settings_form do begin ClientHeight:=control_panel_page_control.Top+hide_tab_sheet.Top; hide_tab_sheet.Show; // in case OK button clicked - to hide the other sheets for next time. end;//with sb_tab_sheets_expanded:=False; end; //______________________________________________________________________________ procedure expand_tab_sheets; begin with dtp_settings_form do begin dtp_settings_panel.Hide; // reduce flicker ClientHeight:=dtp_settings_panel.Height; //650; dtp_settings_panel.Show; end;//with sb_tab_sheets_expanded:=True; end; //______________________________________________________________________________ procedure Tdtp_settings_form.guide_lines_checkboxClick(Sender: TObject); begin with dtp_form do begin if updating_now=True then EXIT; if NOT assigned(dtp_document) then EXIT; if guide_lines_checkbox.Checked=True then dtp_document.HelperMethod:=hmGrid else dtp_document.HelperMethod:=hmNone; end;//with end; //______________________________________________________________________________ procedure Tdtp_settings_form.snap_to_guides_checkboxClick(Sender: TObject); begin with dtp_form do begin if updating_now=True then EXIT; if NOT assigned(dtp_document) then EXIT; dtp_document.SnapToGrid:=snap_to_guides_checkbox.Checked; end;//with end; //______________________________________________________________________________ procedure Tdtp_settings_form.show_margins_checkboxClick(Sender: TObject); begin with dtp_form do begin if updating_now=True then EXIT; if NOT assigned(dtp_document) then EXIT; dtp_document.ShowMargins:=show_margins_checkbox.Checked; end;//with end; //______________________________________________________________________________ procedure AddFontStyle(AStyle:TFontStyle; Checked:boolean); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpTextBaseShape) then begin with TdtpTextBaseShape(selected_shapes_list[i]) do begin if Checked=True then FontStyle:=FontStyle+[AStyle] else FontStyle:=FontStyle-[AStyle]; end;//with end; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ function AnchorsToDescription(Anchors:TShapeAnchors): string; var i:integer; AList:TStringList; begin AList:=TStringList.Create; try if saDefault in Anchors then AList.Add('default') else begin if saPosXProp in Anchors then AList.Add('posX'); if saPosYProp in Anchors then AList.Add('posY'); if saSizeXProp in Anchors then AList.Add('sizeX'); if saSizeYProp in Anchors then AList.Add('sizeY'); if saLeftLock in Anchors then AList.Add('left'); if saTopLock in Anchors then AList.Add('top'); if saRightLock in Anchors then AList.Add('right'); if saBottomLock in Anchors then AList.Add('bottom'); end; RESULT:='[ '; if AList.Count>0 then begin for i:=0 to AList.Count-1 do begin RESULT:=RESULT+AList[i]; if i< AList.Count-1 then RESULT:=RESULT+', '; end;//next end; RESULT:=RESULT+' ]'; finally AList.Free; end; end; //______________________________________________________________________________ // conversion routines to and from model dimensions for the edit boxes ... function convert_pagex_to_padx(page_x:extended):extended; begin RESULT:=page_x; // init if trackplan_exists=False then EXIT; if stretch_factor_wide0); // 212a edit_outline_form.start_new_row_button.Enabled:=(num_markers_selected<3); // 212a edit_outline_form.insert_button.Enabled:=(num_markers_selected=1); // 212a // multiple selected shapes, make the focused shape #0 ... if selected_shapes_list.Count>1 then begin for i:=1 to selected_shapes_list.Count-1 do begin if selected_shapes_list[i]=dtp_form.dtp_document.FocusedShape then begin temp_pointer:=selected_shapes_list[0]; selected_shapes_list[0]:=selected_shapes_list[i]; selected_shapes_list[i]:=temp_pointer; BREAK; end; end;//next end; // and show the shape data on the modify tab.. //ok so far with dtp_settings_form do begin // set header... header_str:=''; // init if selected_shapes_list.Count=1 then begin if (TdtpShape(selected_shapes_list[0]) is TdtpPolygonShape) then begin header_str:='polygon'; with TdtpPolygonShape(selected_shapes_list[0]) do begin outline_only_radio.Checked:=((UseOutline=True) and (UseFill=False)); outline_and_infill_radio.Checked:=((UseOutline=True) and (UseFill=True)); infill_only_radio.Checked:=((UseOutline=False) and (UseFill=True)); if trackplan_exists=True then with outline_width_edit do if NOT Focused then Text:=round_str(OutlineWidth/stretch_factor_wide,1) // model mm else with outline_width_edit do if NOT Focused then Text:=round_str(OutlineWidth,1); // page mm sb_outline_colour_panel.Color:=OutlineColor; sb_infill_colour_panel.Color:=FillColor; fill_transparency_trackbar.Position:=FillAlpha; alpha_fill_label.Caption:=IntToStr((100*FillAlpha) div 255)+'%'; // 205e moved here. position 0-255, shown 0-100%) end;//with polygon_groupbox.Visible:=True; // NOT .Show -- which tries to show tab sheet keep_aspect_ratio_checkbox.Checked:=TdtpPolygonShape(selected_shapes_list[0]).PreserveAspect; end else polygon_groupbox.Visible:=False; if (TdtpShape(selected_shapes_list[0]) is TdtpOutlineMarkerShape) then header_str:='outline marker'; if (TdtpShape(selected_shapes_list[0]) is TdtpTextBaseShape) then begin header_str:='text'; with TdtpTextBaseShape(selected_shapes_list[0]) do begin bold_checkbox.Checked:=(fsBold in FontStyle); italic_checkbox.Checked:=(fsItalic in FontStyle); underline_checkbox.Checked:=(fsUnderline in FontStyle); strikeout_checkbox.Checked:=(fsStrikeout in FontStyle); sb_font_colour_panel.Color:=FontColor; with font_height_mm_edit do if NOT Focused then Text:=round_str(FontHeight/stretch_factor_high,1); with font_name_combo do begin if NOT Focused then begin font_index:=font_name_combo.Items.IndexOf(FontName); if font_index<0 // font in file not available on this computer then begin Text:='! not available: '+FontName; ItemIndex:=-1; end else ItemIndex:=font_index; end; end;//with combo end;//with shape font_groupbox.Visible:=True; text_groupbox.Visible:=True; end else begin font_groupbox.Hide; text_groupbox.Hide; end; if (TdtpShape(selected_shapes_list[0]) is TdtpPolygonText) then header_str:='polygon text'; if (TdtpShape(selected_shapes_list[0]) is TdtpTextShape) then begin header_str:='one-line text'; with single_line_text_edit do if NOT Focused then Text:=TdtpTextShape(selected_shapes_list[0]).Text; with TdtpTextShape(selected_shapes_list[0]) do single_line_text_edit.Font.Color:=FontColor; end; if (TdtpShape(selected_shapes_list[0]) is TdtpMemoShape) then begin header_str:='multi-line text'; with multi_line_text_memo do if NOT Focused then Text:=TdtpMemoShape(selected_shapes_list[0]).Text; with TdtpMemoShape(selected_shapes_list[0]) do begin multi_line_text_memo.Font.Color:=FontColor; with alignment_combo do if NOT Focused then ItemIndex:=integer(Alignment); sb_word_wrap_memo_checkbox.Checked:=WordWrap; end;//with alignment_label.Visible:=True; alignment_combo.Visible:=True; one_line_text_label.Visible:=False; single_line_text_edit.Visible:=False; multi_text_label.Visible:=True; multi_line_text_ok_button.Visible:=True; multi_line_text_memo.Visible:=True; sb_word_wrap_memo_checkbox.Visible:=True; end else begin alignment_label.Visible:=False; alignment_combo.Visible:=False; one_line_text_label.Visible:=True; single_line_text_edit.Visible:=True; multi_text_label.Visible:=False; multi_line_text_ok_button.Visible:=False; multi_line_text_memo.Visible:=False; sb_word_wrap_memo_checkbox.Visible:=False; end; if (TdtpShape(selected_shapes_list[0]) is TdtpCurvedText) then begin header_str:='curved text'; with single_line_text_edit do if NOT Focused then Text:=TdtpCurvedText(selected_shapes_list[0]).Text; with TdtpCurvedText(selected_shapes_list[0]) do begin single_line_text_edit.Font.Color:=FontColor; with curved_text_angle_edit do if NOT Focused then Text:=round_str(CurveAngle,1); perspective_text_checkbox.Checked:=(TransformMethod=tmPoints); end;//with curved_text_angle_label.Visible:=True; curved_text_angle_edit.Visible:=True; curved_text_degrees_label.Visible:=True; curved_text_negative_label.Visible:=True; perspective_text_checkbox.Visible:=True; end else begin curved_text_angle_label.Visible:=False; curved_text_angle_edit.Visible:=False; curved_text_degrees_label.Visible:=False; curved_text_negative_label.Visible:=False; perspective_text_checkbox.Visible:=False; end; if (TdtpShape(selected_shapes_list[0]) is TdtpWavyText) then begin header_str:='wavy text'; with single_line_text_edit do if NOT Focused then Text:=TdtpWavyText(selected_shapes_list[0]).Text; with TdtpWavyText(selected_shapes_list[0]) do begin single_line_text_edit.Font.Color:=FontColor; end;//with end; if (TdtpShape(selected_shapes_list[0]) is TdtpProjectiveText) then begin header_str:='distorted text'; with single_line_text_edit do if NOT Focused then Text:=TdtpProjectiveText(selected_shapes_list[0]).Text; with TdtpProjectiveText(selected_shapes_list[0]) do begin single_line_text_edit.Font.Color:=FontColor; end;//with end; if (TdtpShape(selected_shapes_list[0]) is Tdtp85aRectangleShape) or (TdtpShape(selected_shapes_list[0]) is TdtpRectangleShape) // legacy files then begin if (TdtpShape(selected_shapes_list[0]) is TdtpTriangleShape) then header_str:='triangle' else if (TdtpShape(selected_shapes_list[0]) is TdtpSquareShape) then header_str:='square' else header_str:='rectangle'; end; if (TdtpShape(selected_shapes_list[0]) is Tdtp85aNewRoundRectShape) then header_str:='rounded rectangle' else rounded_rectangle_groupbox.Visible:=False; if (TdtpShape(selected_shapes_list[0]) is Tdtp85aNewRoundRectShape) then begin with Tdtp85aNewRoundRectShape(selected_shapes_list[0]) do begin rounded_rectangle_groupbox.Visible:= NOT now_edited; with corner_radius_edit do if NOT Focused then Text:=round_str(CornerRadius,1); // % end;//with end; if (TdtpShape(selected_shapes_list[0]) is TdtpQuadrangleShape) then begin header_str:='quadrangle'; with TdtpQuadrangleShape(selected_shapes_list[0]) do begin quadrangle_groupbox.Visible:= NOT now_edited; with quadrangle_inner_edit do if NOT Focused then Text:=round_str(InnerSize,1); // % end;//with end else quadrangle_groupbox.Visible:=False; if (TdtpShape(selected_shapes_list[0]) is TdtpCapShape) then begin header_str:='enclosure'; with TdtpCapShape(selected_shapes_list[0]) do begin cap_groupbox.Visible:= NOT now_edited; with cap_inner_edit do if NOT Focused then Text:=round_str(InnerSize,1); // % case OpenSide of 0: cap_left_radio.Checked:=True; 1: cap_top_radio.Checked:=True; 2: cap_right_radio.Checked:=True; 3: cap_bottom_radio.Checked:=True; 4: cap_closed_radio.Checked:=True; end;//case end;//with end else cap_groupbox.Visible:=False; if (TdtpShape(selected_shapes_list[0]) is TdtpFreehandShape) then header_str:='freehand'; if (TdtpShape(selected_shapes_list[0]) is Tdtp85aEllipseShape) or (TdtpShape(selected_shapes_list[0]) is TdtpEllipseShape) // legacy files then begin if (TdtpShape(selected_shapes_list[0]) is TdtpRingShape) then begin with ring_inner_dia_edit do if NOT Focused then Text:=round_str(TdtpRingShape(selected_shapes_list[0]).InnerRad,1); if (TdtpShape(selected_shapes_list[0]) is TdtpFilledArcShape) then begin header_str:='arc'; full_sector_label.Visible:=True; corner_flip_label.Visible:=False; ring_arc_groupbox.Caption:=' arc : '; end else if (TdtpShape(selected_shapes_list[0]) is TdtpCornerShape) then begin header_str:='corner'; full_sector_label.Visible:=False; corner_flip_label.Visible:=True; ring_arc_groupbox.Caption:=' corner : '; end else begin header_str:='ring'; full_sector_label.Visible:=False; corner_flip_label.Visible:=False; ring_arc_groupbox.Caption:=' ring : '; end; ring_arc_groupbox.Visible:= NOT TdtpRingShape(selected_shapes_list[0]).now_edited; end else begin ring_arc_groupbox.Visible:=False; if (TdtpShape(selected_shapes_list[0]) is TdtpSegmentShape) then header_str:='segment' else if TdtpShape(selected_shapes_list[0]).DocWidth=TdtpShape(selected_shapes_list[0]).DocHeight then header_str:='circle' else header_str:='ellipse'; end; end else ring_arc_groupbox.Visible:=False; if (TdtpShape(selected_shapes_list[0]) is TdtpLineShape) then begin header_str:='line'; with TdtpLineShape(selected_shapes_list[0]) do begin if trackplan_exists=True then begin with line_width_edit do if NOT Focused then Text:=round_str(LineWidth/stretch_factor_wide,1); // model mm with edArrow1Width do if NOT Focused then Text:=round_str(Arrows[0].Width/stretch_factor_wide,1); with edArrow1Length do if NOT Focused then Text:=round_str(Arrows[0].Length/stretch_factor_wide,1); with edArrow2Width do if NOT Focused then Text:=round_str(Arrows[1].Width/stretch_factor_wide,1); with edArrow2Length do if NOT Focused then Text:=round_str(Arrows[1].Length/stretch_factor_wide,1); end else begin with line_width_edit do if NOT Focused then Text:=round_str(LineWidth,1); // page mm with edArrow1Width do if NOT Focused then Text:=round_str(Arrows[0].Width,1); with edArrow1Length do if NOT Focused then Text:=round_str(Arrows[0].Length,1); with edArrow2Width do if NOT Focused then Text:=round_str(Arrows[1].Width,1); with edArrow2Length do if NOT Focused then Text:=round_str(Arrows[1].Length,1); end; with arrow1_combo do if NOT Focused then ItemIndex:=integer(Arrows[0].Style); with arrow2_combo do if NOT Focused then ItemIndex:=integer(Arrows[1].Style); end;//with line_groupbox.Visible:=True; end else line_groupbox.Hide; if (TdtpShape(selected_shapes_list[0]) is TdtpBitmapShape) then begin if check_track_plan(TdtpShape(selected_shapes_list[0]).Name)=True // a trackplan then header_str:='trackplan item - raster (bitmap image)' else header_str:='bitmap image'; with TdtpBitmapShape(selected_shapes_list[0]) do begin image_width_pixels_label.Caption:='width: '+IntToStr(Image.Bitmap.Width)+' dots'; image_height_pixels_label.Caption:='height: '+IntToStr(Image.Bitmap.Height)+' dots'; with image_filename_edit do if NOT Focused then Text:=ExtractFileName(Image.FileName); keep_aspect_ratio_checkbox.Checked:=PreserveAspect; end;//with image_groupbox.Visible:=True; if (TdtpShape(selected_shapes_list[0]) is TdtpSnapBitmap) then header_str:='snap bitmap'; end else image_groupbox.Hide; if (TdtpShape(selected_shapes_list[0]) is TdtpExposedMetafile) then begin if check_track_plan(TdtpShape(selected_shapes_list[0]).Name)=True // a trackplan then header_str:='trackplan item - vector (metafile)' else begin with TdtpExposedMetafile(selected_shapes_list[0]) do begin if RvfShape=True // RVF text in a metafile then begin header_str:='formatted text block'; if RvfTransparent=True then modify_tab_rich_view.Color:=clWhite else modify_tab_rich_view.Color:=RvfBackgndColour; if RvfAddBorder=True then begin rvf_bgnd_shape.Pen.Color:=RvfBorderColour; rvf_bgnd_shape.Brush.Color:=RvfBorderColour; rvf_bgnd_shape.Visible:=True; end else rvf_bgnd_shape.Visible:=False; // no border modify_tab_rich_view.LeftMargin:=RvfLeftMargin; // dots... modify_tab_rich_view.TopMargin:=RvfTopMargin; modify_tab_rich_view.RightMargin:=RvfRightMargin; modify_tab_rich_view.BottomMargin:=RvfBottomMargin; if (RvfWidth>0) and (RvfHeight>0) then begin modify_tab_rich_view.ClientWidth:=RvfWidth; modify_tab_rich_view.ClientHeight:=RvfHeight; end; data_stream:=TMemoryStream.Create; data_list:=TStringList.Create; try with data_list do Text:=RvfData; data_list.SaveToStream(data_stream); current_formatted_text_str:=data_list.Text; data_stream.Position:=0; modify_tab_rich_view.Clear; modify_tab_rich_view.LoadRVFFromStream(data_stream); modify_tab_rich_view.Format; finally data_stream.Free; data_list.Free; end; end else header_str:='metafile image'; end;//with shape end;//metafile not trackplan sb_metafile_pen_colour_panel.Color:=TdtpExposedMetafile(selected_shapes_list[0]).Pen.Color; sb_metafile_brush_colour_panel.Color:=TdtpExposedMetafile(selected_shapes_list[0]).Brush.Color; emf_replace_pen_checkbox.Checked:=TdtpExposedMetafile(selected_shapes_list[0]).OverridePen; // added 205e emf_replace_brush_checkbox.Checked:=TdtpExposedMetafile(selected_shapes_list[0]).OverrideBrush; // added 205e with metafile_pen_width_edit do if NOT Focused then Text:=IntToStr(TdtpExposedMetafile(selected_shapes_list[0]).Pen.Width); // added 205e with emf_replace_brush_combo do if NOT Focused then ItemIndex:=integer(TdtpExposedMetafile(selected_shapes_list[0]).Brush.Style); // added 205e with emf_replace_pen_combo do if NOT Focused then ItemIndex:=integer(TdtpExposedMetafile(selected_shapes_list[0]).Pen.Style); // added 205e metafile_groupbox.Visible:=True; rvf_groupbox.Visible:=TdtpExposedMetafile(selected_shapes_list[0]).RvfShape; if TdtpExposedMetafile(selected_shapes_list[0]).CreatedBy<>'' then begin metafile_data_memo.Lines.Text:='created by: '+TdtpExposedMetafile(selected_shapes_list[0]).CreatedBy +#13+TdtpExposedMetafile(selected_shapes_list[0]).Description; set_boundary_rectangle_button.Visible:=True; end else begin metafile_data_memo.Lines.Text:='no data available'; set_boundary_rectangle_button.Visible:=False; end; metafile_data_groupbox.Visible:= NOT rvf_groupbox.Visible; // 227a keep_aspect_ratio_checkbox.Checked:=TdtpExposedMetafile(selected_shapes_list[0]).PreserveAspect; end else begin metafile_groupbox.Hide; metafile_data_groupbox.Hide; // 227a rvf_groupbox.Hide; end; if (TdtpShape(selected_shapes_list[0]) is Tdtp85aPolygonShape) then begin if Tdtp85aPolygonShape(selected_shapes_list[0]).now_edited=True then begin header_str:='edited '+header_str; undo_edits_button.Enabled:=Tdtp85aPolygonShape(selected_shapes_list[0]).undo_available; end else undo_edits_button.Enabled:=False; re_frame_button.Enabled:=(Tdtp85aPolygonShape(selected_shapes_list[0]).DocAngle<>0); edit_polygon_groupbox.Visible:= NOT edit_outline_form.Visible; // 212a end else edit_polygon_groupbox.visible:=False; if header_str='' then header_str:='combined item'; dimensions_groupbox.Visible:=True; end else begin // count <>1 if selected_shapes_list.Count=0 then header_str:='no items selected' else header_str:='multiple items selected ('+IntToStr(selected_shapes_list.Count)+' items)'; // can't modify if nothing selected, or more than 1 item selected... 208d mod dimensions_groupbox.Hide; polygon_groupbox.Hide; font_groupbox.Hide; text_groupbox.Hide; line_groupbox.Hide; image_groupbox.Hide; metafile_groupbox.Hide; metafile_data_groupbox.Hide; // 227a rvf_groupbox.Hide; rounded_rectangle_groupbox.Hide; ring_arc_groupbox.Hide; // 212a quadrangle_groupbox.Hide; // 212a cap_groupbox.Hide; edit_polygon_groupbox.Hide; // 212a EXIT; end; // set overall dims for main shape [0] ... with TdtpShape(selected_shapes_list[0]) do begin if check_track_plan(Name)=True // its a trackplan then begin rotation_label.Font.Color:=$00AAAAAA; // mid grey (disabled) degrees_label.Font.Color:=$00AAAAAA; flip_checkbox.Enabled:=False; mirror_checkbox.Enabled:=False; item_name_edit.Enabled:=False; item_name_edit.Font.Color:=clSilver; item_name_edit.Font.Style:=[fsItalic]; with item_name_edit do if NOT Focused then Text:=' trackplan item'; end else begin if trackplan_exists=True // 205e moved here then begin rotation_label.Font.Color:=clBlue; degrees_label.Font.Color:=clBlue; end else begin rotation_label.Font.Color:=clRed; degrees_label.Font.Color:=clRed; end; flip_checkbox.Enabled:=True; mirror_checkbox.Enabled:=True; item_name_edit.Enabled:=True; item_name_edit.Font.Color:=clBlue; item_name_edit.Font.Style:=[fsBold]; with item_name_edit do if NOT Focused then Text:=TdtpShape(selected_shapes_list[0]).Name; end; // bounds... if trackplan_exists=True // model... then begin // X,Y is to bottom left corner after rotation... with x_edit do if NOT Focused then Text:=Format(cDefaultMMFormat,[convert_pagex_to_padx(DocLeft)+SIN(DocAngle*Pi/180)*DocHeight/stretch_factor_high]); with y_edit do if NOT Focused then Text:=Format(cDefaultMMFormat,[convert_pagey_to_pady(DocTop)-COS(DocAngle*Pi/180)*DocHeight/stretch_factor_high]); with item_width_edit do if NOT Focused then Text:=round_str(DocWidth/stretch_factor_wide,1); with item_height_edit do if NOT Focused then Text:=round_str(DocHeight/stretch_factor_high,1); end else begin // page... // X,Y is to top left corner... with x_edit do if NOT Focused then Text:=Format(cDefaultMMFormat,[DocLeft]); with y_edit do if NOT Focused then Text:=Format(cDefaultMMFormat,[DocTop]); with item_width_edit do if NOT Focused then Text:=Format(cDefaultMMFormat,[DocWidth]); with item_height_edit do if NOT Focused then Text:=Format(cDefaultMMFormat,[DocHeight]); end; // rotation angle.. with angle_edit do if NOT Focused then Text:=Format(cDefaultDegFormat,[DocAngle]); // alpha transparency.. master_transparency_trackbar.Position:=MasterAlpha; alpha_master_label.Caption:=IntToStr((100*MasterAlpha) div 255)+'%'; // 205e moved here. position 0-255, shown 0-100%) ref_checkbox.Checked:=Tdtp_shape_tag(TdtpShape(selected_shapes_list[0]).Tag).reference; // 227a no_update_checkbox.Checked:=Tdtp_shape_tag(TdtpShape(selected_shapes_list[0]).Tag).no_update; no_delete_checkbox.Checked:= NOT AllowDelete; no_select_checkbox.Checked:= NOT AllowSelect; lock_size_checkbox.Checked:= NOT AllowResize; lock_position_checkbox.Checked:= NOT AllowMove; lock_angle_checkbox.Checked:= NOT AllowRotate; mirror_checkbox.Checked:=Mirrored; flip_checkbox.Checked:=Flipped; end;//with shape end;//with form finally dtp_settings_form.tab_header_label.Caption:=header_str; // set once only, otherwise OnIdle repeats endlessly end;//try end; //______________________________________________________________________________ procedure Tdtp_settings_form.angle_editExit(Sender: TObject); var box_value:extended; i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; if sb_check_valid_float(angle_edit,-360,360,box_value)=False then EXIT; // invalid input limits -360 - +360 degrees try dtp_document.BeginUpdate; // DocRotate rotates around centre (simply setting DocAngle rotates around top left corner)... for i:=0 to selected_shapes_list.Count-1 do begin TdtpShape(selected_shapes_list[i]).DocRotate(box_value); end;//next finally dtp_document.EndUpdate; end;//try end;//with form end; //______________________________________________________________________________ procedure x_edit_set(x_box_value:extended); // 226e use current data in x_edit var i:integer; //////////////////////////////////////////////////////////////// function box_value_sb_x:extended; // convert entered X dims from pad mm to page mm. begin RESULT:=dtp_form.dtp_document.WindowLeft+(x_box_value-model_ruler_x_offset)*stretch_factor_wide; end; //////////////////////////////////////////////////////////////// begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; if trackplan_exists=True then begin for i:=0 to selected_shapes_list.Count-1 do begin with TdtpShape(selected_shapes_list[i]) do DocLeft:=box_value_sb_x-SIN(DocAngle*Pi/180)*DocHeight; end;//next end else begin for i:=0 to selected_shapes_list.Count-1 do TdtpShape(selected_shapes_list[i]).DocLeft:=x_box_value; end; dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.x_editExit(Sender: TObject); // 226e var x_box_value:extended; begin if sb_check_valid_float(x_edit,-100000,100000,x_box_value)=False then EXIT; // input limits -100000mm - 100000mm x_edit_set(x_box_value); end; //______________________________________________________________________________ procedure Tdtp_settings_form.xposn_updownClick(Sender:TObject; Button:TUDBtnType); var x_box_value:extended; begin if x_edit.Focused=True then item_name_edit.SetFocus; // make sure edit not focused (for OnIdle) Application.ProcessMessages; // ensure box values updated (OnIdle) if sb_check_valid_float(x_edit,-100000,100000,x_box_value)=False then EXIT; // input limits -100000mm - 100000mm if Button=btNext // 0.1mm increments then x_edit_set(x_box_value+0.1) else x_edit_set(x_box_value-0.1); end; //______________________________________________________________________________ procedure y_edit_set(y_box_value:extended); // 226e use current data in y_edit var i:integer; //////////////////////////////////////////////////////////// function box_value_sb_y:extended; // convert entered Y dims from pad mm to page mm. begin RESULT:=dtp_form.dtp_document.WindowTop-(y_box_value+model_ruler_y_offset)*stretch_factor_high; end; //////////////////////////////////////////////////////////// begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; if trackplan_exists=True then begin for i:=0 to selected_shapes_list.Count-1 do begin with TdtpShape(selected_shapes_list[i]) do DocTop:=box_value_sb_y-COS(DocAngle*Pi/180)*DocHeight; end;//next end else begin for i:=0 to selected_shapes_list.Count-1 do TdtpShape(selected_shapes_list[i]).DocTop:=y_box_value; end; dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.y_editExit(Sender: TObject); // 226e var y_box_value:extended; begin if sb_check_valid_float(y_edit,-100000,100000,y_box_value)=False then EXIT; // input limits -100000mm - 100000mm y_edit_set(y_box_value); end; //______________________________________________________________________________ procedure Tdtp_settings_form.yposn_updownClick(Sender:TObject; Button:TUDBtnType); var y_box_value:extended; y_move:extended; begin if y_edit.Focused=True then item_name_edit.SetFocus; // make sure edit not focused (for OnIdle) Application.ProcessMessages; // ensure box values updated (OnIdle) if sb_check_valid_float(y_edit,-100000,100000,y_box_value)=False then EXIT; // input limits -100000mm - 100000mm if trackplan_exists=True // 0.1mm increments then y_move:=0.1 else y_move:=0-0.1; if Button=btNext then y_edit_set(y_box_value+y_move) else y_edit_set(y_box_value-y_move); end; //______________________________________________________________________________ procedure w_edit_set(w_box_value:extended); // 226e use current data in w_edit var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do TdtpShape(selected_shapes_list[i]).DocWidth:=box_value_sb_wide(w_box_value); dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.item_width_editExit(Sender:TObject); // 226e var w_box_value:extended; begin if sb_check_valid_float(item_width_edit,-100000,100000,w_box_value)=False then EXIT; // input limits -100000mm - 100000mm w_edit_set(w_box_value); end; //______________________________________________________________________________ procedure Tdtp_settings_form.width_updownClick(Sender: TObject; Button: TUDBtnType); // 226e var w_box_value:extended; begin if item_width_edit.Focused=True then item_name_edit.SetFocus; // make sure edit not focused (for OnIdle) Application.ProcessMessages; // ensure box values updated (OnIdle) if sb_check_valid_float(item_width_edit,-100000,100000,w_box_value)=False then EXIT; // input limits -100000mm - 100000mm if Button=btNext // 0.1mm increments then w_edit_set(w_box_value+0.1) else w_edit_set(w_box_value-0.1); end; //______________________________________________________________________________ procedure h_edit_set(h_box_value:extended); // 226e use current data in h_edit (needs y value too) var i:integer; y_box_value:extended; //////////////////////////////////////////////////////////// function box_value_sb_y:extended; // convert entered Y dims from pad mm to page mm. begin RESULT:=dtp_form.dtp_document.WindowTop-(y_box_value+model_ruler_y_offset)*stretch_factor_high; end; //////////////////////////////////////////////////////////// begin if selected_shapes_list.Count<1 then EXIT; if sb_check_valid_float(dtp_settings_form.y_edit,-100000,100000,y_box_value)=False then EXIT; // input limits -100000mm - 100000mm with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin with TdtpShape(selected_shapes_list[i]) do begin DocHeight:=box_value_sb_high(h_box_value); if trackplan_exists=True then DocTop:=box_value_sb_y-COS(DocAngle*Pi/180)*DocHeight; end;//with end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.item_height_editExit(Sender: TObject); var h_box_value:extended; begin if sb_check_valid_float(item_height_edit,0.01,100000,h_box_value)=False then EXIT; // input limits 0.01mm - 100000mm h_edit_set(h_box_value); end; //______________________________________________________________________________ procedure Tdtp_settings_form.depth_updownClick(Sender: TObject; Button: TUDBtnType); // 226e var h_box_value:extended; h_move:extended; begin if item_height_edit.Focused=True then item_name_edit.SetFocus; // make sure edit not focused (for OnIdle) Application.ProcessMessages; // ensure box values updated (OnIdle) if sb_check_valid_float(item_height_edit,0.01,100000,h_box_value)=False then EXIT; // input limits 0.01mm - 100000mm if trackplan_exists=True // 0.1mm increments then h_move:=0.1 else h_move:=0-0.1; if Button=btNext then h_edit_set(h_box_value+h_move) else h_edit_set(h_box_value-h_move); end; //______________________________________________________________________________ procedure Tdtp_settings_form.master_transparency_trackbarChange(Sender:TObject); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin with TdtpShape(selected_shapes_list[i]) do begin // This ensures that we don't get 1001 undo states when moving the slider up and down NextUndoNoRepeatedPropertyChange; MasterAlpha:=master_transparency_trackbar.Position; end;//with end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.font_name_comboChange(Sender:TObject); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; // Avoid invalid index if (font_name_combo.ItemIndex<0) or (font_name_combo.ItemIndex>font_name_combo.Items.Count-1) then EXIT; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpTextBaseShape) then TdtpTextBaseShape(selected_shapes_list[i]).FontName:=font_name_combo.Items[font_name_combo.ItemIndex]; // 205e was .Text; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.bold_checkboxClick(Sender:TObject); begin AddFontStyle(fsBold, bold_checkbox.Checked); end; //______________________________________________________________________________ procedure Tdtp_settings_form.italic_checkboxClick(Sender:TObject); begin AddFontStyle(fsItalic, italic_checkbox.Checked); end; //______________________________________________________________________________ procedure Tdtp_settings_form.strikeout_checkboxClick(Sender:TObject); begin AddFontStyle(fsStrikeout, strikeout_checkbox.Checked); end; //______________________________________________________________________________ procedure Tdtp_settings_form.underline_checkboxClick(Sender:TObject); begin AddFontStyle(fsUnderline, underline_checkbox.Checked); end; //______________________________________________________________________________ procedure Tdtp_settings_form.font_height_mm_editExit(Sender:TObject); var i:integer; box_value:extended; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; if sb_check_valid_float(font_height_mm_edit,0.1,1000,box_value)=False then EXIT; // input limits 0.1mm - 1000mm dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpTextBaseShape) then TdtpTextBaseShape(selected_shapes_list[i]).FontHeight:=box_value_sb_high(box_value); end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.alignment_comboChange(Sender:TObject); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; // Avoid invalid index if (alignment_combo.ItemIndex<0) or (alignment_combo.ItemIndex>alignment_combo.Items.Count-1) then EXIT; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpTextShape) then TdtpTextShape(selected_shapes_list[i]).Alignment:=TAlignment(alignment_combo.ItemIndex); if (TdtpShape(selected_shapes_list[i]) is TdtpMemoShape) then TdtpMemoShape(selected_shapes_list[i]).Alignment:=TAlignment(alignment_combo.ItemIndex); end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.single_line_text_editExit(Sender:TObject); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpTextShape) then TdtpTextShape(selected_shapes_list[i]).Text:=Trim(single_line_text_edit.Text)+' '; // Dtp bug - add spaces to ensure outline wide enough //sdUtf8ToUnicode(edText.Text); if (TdtpShape(selected_shapes_list[i]) is TdtpPolygonText) // curved text then TdtpPolygonText(selected_shapes_list[i]).Text:=single_line_text_edit.Text; //sdUtf8ToUnicode(edText.Text); end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.mirror_checkboxClick(Sender:TObject); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; try for i:=0 to selected_shapes_list.Count-1 do begin TdtpShape(selected_shapes_list[i]).Mirrored:=mirror_checkbox.Checked; end;//next finally dtp_document.EndUpdate; end;//try end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.flip_checkboxClick(Sender:TObject); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; try for i:=0 to selected_shapes_list.Count-1 do begin TdtpShape(selected_shapes_list[i]).Flipped:=flip_checkbox.Checked; end;//next finally dtp_document.EndUpdate; end;//try end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.emf_replace_pen_comboChange(Sender: TObject); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; with emf_replace_pen_combo do if (ItemIndex<0) or (ItemIndex>Items.Count-1) then ItemIndex:=0; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpExposedMetafile) then TdtpExposedMetafile(selected_shapes_list[i]).Pen.Style:=TPenStyle(emf_replace_pen_combo.ItemIndex); end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.emf_replace_brush_comboChange(Sender:TObject); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; with emf_replace_brush_combo do if (ItemIndex<0) or (ItemIndex>Items.Count-1) then ItemIndex:=0; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpExposedMetafile) then TdtpExposedMetafile(selected_shapes_list[i]).Brush.Style:=TBrushStyle(emf_replace_brush_combo.ItemIndex); end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.emf_replace_brush_checkboxClick(Sender:TObject); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpExposedMetafile) then TdtpExposedMetafile(selected_shapes_list[i]).OverrideBrush:=emf_replace_brush_checkbox.Checked; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.emf_replace_pen_checkboxClick(Sender:TObject); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpExposedMetafile) then TdtpExposedMetafile(selected_shapes_list[i]).OverridePen:=emf_replace_pen_checkbox.Checked; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.keep_aspect_ratio_checkboxClick(Sender:TObject); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpExposedMetafile) then TdtpExposedMetafile(selected_shapes_list[i]).PreserveAspect:=keep_aspect_ratio_checkbox.Checked; if (TdtpShape(selected_shapes_list[i]) is TdtpBitmapShape) then TdtpBitmapShape(selected_shapes_list[i]).PreserveAspect:=keep_aspect_ratio_checkbox.Checked; if (TdtpShape(selected_shapes_list[i]) is TdtpPolygonShape) then TdtpPolygonShape(selected_shapes_list[i]).PreserveAspect:=keep_aspect_ratio_checkbox.Checked; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.metafile_pen_width_editExit(Sender:TObject); var i:integer; box_value:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; if sb_check_valid_int(metafile_pen_width_edit,1,500,box_value)=False then EXIT; // input limits 1 dot to 500 dots dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpExposedMetafile) then TdtpExposedMetafile(selected_shapes_list[i]).Pen.Width:=box_value; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.ring_inner_dia_editExit(Sender: TObject); // 212a var i:integer; box_value:extended; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; if sb_check_valid_float(ring_inner_dia_edit,0,99,box_value)=False then EXIT; // input limits 0 - 99 % dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpRingShape) then TdtpRingShape(selected_shapes_list[i]).InnerRad:=box_value; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.quadrangle_inner_editExit(Sender: TObject); // 212a var i:integer; box_value:extended; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; if sb_check_valid_float(quadrangle_inner_edit,1,49,box_value)=False then EXIT; // input limits 1 - 49 % dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpQuadrangleShape) then TdtpQuadrangleShape(selected_shapes_list[i]).InnerSize:=box_value; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.cap_inner_editExit(Sender: TObject); // 212a var i:integer; box_value:extended; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; if sb_check_valid_float(cap_inner_edit,1,49,box_value)=False then EXIT; // input limits 1 - 49 % dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpCapShape) then TdtpCapShape(selected_shapes_list[i]).InnerSize:=box_value; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure set_cap_open_side(side:integer); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpCapShape) then TdtpCapShape(selected_shapes_list[i]).OpenSide:=side; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.cap_left_radioClick(Sender: TObject); begin set_cap_open_side(0); end; //__________________________ procedure Tdtp_settings_form.cap_top_radioClick(Sender: TObject); begin set_cap_open_side(1); end; //__________________________ procedure Tdtp_settings_form.cap_right_radioClick(Sender: TObject); begin set_cap_open_side(2); end; //__________________________ procedure Tdtp_settings_form.cap_bottom_radioClick(Sender: TObject); begin set_cap_open_side(3); end; //__________________________ procedure Tdtp_settings_form.cap_closed_radioClick(Sender: TObject); begin set_cap_open_side(4); end; //______________________________________________________________________________ procedure Tdtp_settings_form.save_image_file_buttonClick(Sender:TObject); var file_str:string; ext_str:string; begin if selected_shapes_list.Count<1 then EXIT; with save_bitmap_dialog do begin FileName:=image_filename_edit.Text; Filter:='PNG image ( .png)|*.png|GIF image ( .gif)|*.gif|JPEG image ( .jpg .jp .jpeg)|*.jpg;*.jp;*.jpeg|BMP image ( .bmp)|*.bmp'; if his_image_file_name<>'' then InitialDir:=ExtractFilePath(his_image_file_name) else InitialDir:=exe_str+'IMAGE-FILES\'; DefaultExt:='png'; // init FilterIndex:=1; ext_str:=LowerCase(ExtractFileExt(FileName)); if ext_str='.bmp' then begin DefaultExt:='bmp'; FilterIndex:=4; end; if (ext_str='.jpg') or (ext_str='.jp') or (ext_str='.jpeg') then begin DefaultExt:='jpg'; FilterIndex:=3; end; if ext_str='.gif' then begin DefaultExt:='gif'; FilterIndex:=2; end; if Execute=False then EXIT; his_image_file_name:=FileName; // so we can use the same folder next time. // invalid entered chars removed by dialog file_str:=ExtractFilePath(FileName)+lower_case_filename(ExtractFileName(FileName)); // to underscores and lower case end;//with Screen.Cursor:=crHourGlass; // needed for large images or slow systems with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; if (TdtpShape(selected_shapes_list[0]) is TdtpBitmapShape) then with TdtpBitmapShape(selected_shapes_list[0]) do SaveImageToFile(file_str,Image.Bitmap); dtp_document.EndUpdate; end;//with form Screen.Cursor:=crDefault; end; //______________________________________________________________________________ procedure Tdtp_settings_form.zoom_image_actual_buttonClick(Sender:TObject); // 0.94.a var new_dpm:extended; delta_X,delta_Y:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; if (TdtpShape(selected_shapes_list[0]) is TdtpBitmapShape) then begin with TdtpBitmapShape(selected_shapes_list[0]) do begin dtp_document.AutoWidth:=True; // !important - ZoomPerCent does nothing otherwise new_dpm:=Image.Bitmap.Width/DocWidth; dtp_document.ZoomPerCent:=dtp_document.ZoomPerCent*new_dpm/dtp_document.ScreenDpm; delta_X:=Round(DocLeft*dtp_document.ScreenDpm)-10; // 10 pixels arbitrary to provide top/left margin around image. delta_Y:=Round(DocTop*dtp_document.ScreenDpm)-10; dtp_document.ScrollBy(delta_X,delta_Y); // var parameters, but ignore new value, if any. end;//with end; dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.outline_only_radioClick(Sender: TObject); // this routine for click on any of three radio buttons var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpPolygonShape) then begin TdtpPolygonShape(selected_shapes_list[i]).UseOutline:=outline_only_radio.Checked or outline_and_infill_radio.Checked; TdtpPolygonShape(selected_shapes_list[i]).UseFill:= infill_only_radio.Checked or outline_and_infill_radio.Checked; end; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.sb_outline_colour_buttonClick(Sender: TObject); var colour:TColor; i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; colour:=sb_outline_colour_panel.Color; colour:=get_colour('choose an outline colour for this sketchboard item',colour); sb_outline_colour_panel.Color:=colour; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpPolygonShape) then TdtpPolygonShape(selected_shapes_list[i]).OutlineColor:=colour; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.sb_infill_colour_buttonClick(Sender:TObject); var colour:TColor; i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; colour:=sb_infill_colour_panel.Color; colour:=get_colour('choose an infill colour for this sketchboard item',colour); sb_infill_colour_panel.Color:=colour; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpPolygonShape) then TdtpPolygonShape(selected_shapes_list[i]).FillColor:=colour; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.match_track_bgnd_buttonClick(Sender: TObject); // 206a var colour:TColor; i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; colour:=save_sb_track_bgnd; // 206a sb_infill_colour_panel.Color:=colour; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpPolygonShape) then TdtpPolygonShape(selected_shapes_list[i]).FillColor:=colour; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.sb_metafile_pen_colour_buttonClick(Sender:TObject); var colour:TColor; i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; colour:=sb_metafile_pen_colour_panel.Color; colour:=get_colour('choose a replacement line colour for this trackplan / metafile',colour); sb_metafile_pen_colour_panel.Color:=colour; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpExposedMetafile) then TdtpExposedMetafile(selected_shapes_list[i]).Pen.Color:=colour; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.sb_metafile_brush_colour_buttonClick(Sender:TObject); var colour:TColor; i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; colour:=sb_metafile_brush_colour_panel.Color; colour:=get_colour('choose a replacement infill colour for this trackplan / metafile',colour); sb_metafile_brush_colour_panel.Color:=colour; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpExposedMetafile) then TdtpExposedMetafile(selected_shapes_list[i]).Brush.Color:=colour; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.edit_rvf_buttonClick(Sender: TObject); var data_stream,rvf_stream,emf_stream:TMemoryStream; data_list:TStringList; formatted_txt_metafile:TMetafile; formatted_txt_metafile_canvas:TMetaFileCanvas; old_rvf_width,old_rvf_height:integer; border_width,border_height:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; with sb_rich_form do begin if (TdtpShape(selected_shapes_list[0]) is TdtpExposedMetafile) then begin with TdtpExposedMetafile(selected_shapes_list[0]) do begin if RvfShape=True then begin with sb_rvf_outer_form do begin ok_button.Caption:='update sketchboard'; ok_button.Hint:=' update text block on sketchboard - Insert key '; exit_menu_entry.Caption:='update on sketchboard and close'; updating_from_sb:=True; // programmatic clicks not wanted 212a rvf_transparent_checkbox.Checked:=RvfTransparent; // 85A added 20-03-2015 True = metafile has transparent background, colour ignored if RvfTransparent=True then begin sb_rvf_editor.Color:=clWhite; rvf_bgnd_colour_panel.Color:=clWhite; end else begin sb_rvf_editor.Color:=RvfBackgndColour; rvf_bgnd_colour_panel.Color:=RvfBackgndColour; end; margin_left_edit.Text:=IntToStr(RvfLeftMargin); // 85A added 20-03-2015 dots... margin_top_edit.Text:=IntToStr(RvfTopMargin); // 85A added 20-03-2015 dots... margin_right_edit.Text:=IntToStr(RvfRightMargin); // 85A added 20-03-2015 dots... margin_bottom_edit.Text:=IntToStr(RvfBottomMargin); // 85A added 20-03-2015 dots... rvf_border_colour_panel.Color:=RvfBorderColour; // 85A added 20-03-2015 blue default rvf_add_border_checkbox.Checked:=RvfAddBorder; // 85A added 20-03-2015 if RvfAddBorder=True then sb_rich_form.Color:=RvfBorderColour // makes 1-dot border else sb_rich_form.Color:=$00F1E3D7; // no border updating_from_sb:=False; end;//with sb_rvf_editor.LeftMargin:=RvfLeftMargin; // 85A added 20-03-2015 dots... sb_rvf_editor.TopMargin:=RvfTopMargin; // 85A added 20-03-2015 sb_rvf_editor.RightMargin:=RvfRightMargin; // 85A added 20-03-2015 sb_rvf_editor.BottomMargin:=RvfBottomMargin; // 85A added 20-03-2015 old_rvf_width:=RvfWidth; // 85A added 29-12-2011 metafile width in pixels old_rvf_height:=RvfHeight; // 85A added 29-12-2011 metafile height in pixels if (old_rvf_width>0) and (old_rvf_height>0) then begin sb_rvf_editor.ClientWidth:=old_rvf_width; // ClientWidth inside scrollbar sb_rich_form.ClientWidth:=sb_rvf_editor.Width+sb_rvf_editor.Left*2; // +*2 for border; // 212a end; data_stream:=TMemoryStream.Create; data_list:=TStringList.Create; try data_list.Text:=current_formatted_text_str; data_list.SaveToStream(data_stream); data_stream.Position:=0; sb_rvf_editor.Clear; sb_rvf_editor.LoadRVFFromStream(data_stream); sb_rvf_editor.Format; finally data_stream.Free; data_list.Free; end; if do_show_modal(sb_rvf_outer_form)=mrOk // 212a ShowModal and wait for input then begin Screen.Cursor:=crHourGlass; // may be needed for large images or slow systems formatted_txt_metafile:=TMetafile.Create; formatted_txt_metafile.Enhanced:=True; // emf format formatted_txt_metafile.Transparent:=True; formatted_txt_metafile.Width:=sb_rvf_editor.ClientWidth; sb_rvf_reporter.RichView.Style:=sb_rvf_style; sb_rvf_reporter.RichView.RTFReadProperties.TextStyleMode:=rvrsAddIfNeeded; sb_rvf_reporter.RichView.RTFReadProperties.ParaStyleMode:=rvrsAddIfNeeded; sb_rvf_reporter.RichView.Color:=sb_rvf_editor.Color; // 212a // left and right margins included in RichView output // top and bottom margins added manually to output sb_rvf_reporter.RichView.LeftMargin:=sb_rich_form.sb_rvf_editor.LeftMargin; sb_rvf_reporter.RichView.TopMargin:=0; sb_rvf_reporter.RichView.RightMargin:=sb_rich_form.sb_rvf_editor.RightMargin; sb_rvf_reporter.RichView.BottomMargin:=0; rvf_stream:=TMemoryStream.Create; try sb_rvf_editor.SaveRVFToStream(rvf_stream,False); rvf_stream.Position:=0; sb_rvf_reporter.RichView.LoadRVFFromStream(rvf_stream); finally rvf_stream.Free; end;//try sb_rvf_reporter.Init(dtp_form.Canvas,formatted_txt_metafile.Width); // if document does not have page breaks, it will be formatted on one page.. repeat until sb_rvf_reporter.FormatNextPage($FFFFFF)=False; // very large value repeat for all pages or one formatted_txt_metafile.Height:=sb_rvf_reporter.EndAt+sb_rvf_editor.TopMargin+sb_rvf_editor.BottomMargin; border_width:=formatted_txt_metafile.Width; // 212a border_height:=formatted_txt_metafile.Height; formatted_txt_metafile_canvas:=TMetaFileCanvas.Create(formatted_txt_metafile,dtp_form.Canvas.Handle); // formatted_txt_metafile.Width is now 0 !!! if sb_rvf_outer_form.rvf_transparent_checkbox.Checked=False // fill the backround 212a then begin formatted_txt_metafile_canvas.Brush.Color:=sb_rvf_outer_form.rvf_bgnd_colour_panel.Color; formatted_txt_metafile_canvas.Brush.Style:=bsSolid; formatted_txt_metafile_canvas.FillRect(Rect(0,0,border_width,border_height)); // 212a end; if sb_rvf_outer_form.rvf_add_border_checkbox.Checked=True // add border 212a then begin formatted_txt_metafile_canvas.Brush.Color:=sb_rvf_outer_form.rvf_border_colour_panel.Color; formatted_txt_metafile_canvas.Brush.Style:=bsSolid; formatted_txt_metafile_canvas.FrameRect(Rect(0,0,border_width,border_height)); // 212a end; // now draw the content... formatted_txt_metafile_canvas.Brush.Style:=bsClear; sb_rvf_reporter.DrawPageAt(0,sb_rvf_editor.TopMargin,1,formatted_txt_metafile_canvas,True,sb_rvf_reporter.EndAt); formatted_txt_metafile_canvas.Free; // creates the metafile record when the canvas is freed. // formatted_txt_metafile.Width is now restored !!! emf_stream:=TMemoryStream.Create; data_stream:=TMemoryStream.Create; // re-use data_list:=TStringList.Create; // re-use try formatted_txt_metafile.SaveToStream(emf_stream); emf_stream.Position:=0; PreserveAspect:=False; // may have been changed if (old_rvf_width>0) and (old_rvf_height>0) {and (resize_fit_checkbox.Checked=True)} // rescale the shape... then begin DocWidth:=DocWidth*formatted_txt_metafile.Width/old_rvf_width+1; DocHeight:=DocHeight*formatted_txt_metafile.Height/old_rvf_height; DocWidth:=DocWidth-1; // +1 -1 kludge to force bitmap update if item rotated and no width change on editor end; RvfWidth:=formatted_txt_metafile.Width; // added 29-12-2011 metafile width in pixels RvfHeight:=formatted_txt_metafile.Height; // added 29-12-2011 metafile height in pixels with sb_rvf_outer_form do begin RvfBackgndColour:=rvf_bgnd_colour_panel.Color; // 85A added 20-03-2015 metafile background colour 212a RvfTransparent:=rvf_transparent_checkbox.Checked; // 85A added 20-03-2015 True = metafile has transparent background, colour ignored RvfBorderColour:=rvf_border_colour_panel.Color; // 85A added 20-03-2015 blue default RvfAddBorder:=rvf_add_border_checkbox.Checked; // 85A added 20-03-2015 end;//with RvfLeftMargin:=sb_rvf_editor.LeftMargin; // added 20-03-2015 dots... RvfTopMargin:=sb_rvf_editor.TopMargin; // added 20-03-2015 RvfRightMargin:=sb_rvf_editor.RightMargin; // added 20-03-2015 RvfBottomMargin:=sb_rvf_editor.BottomMargin; // added 20-03-2015 // modified image.. Image.LoadFromStream(emf_stream,'.emf',0); Modified:=True; // to redraw with new metafile // and the modified RVF data... if sb_rvf_editor.SaveRVFToStream(data_stream,False)=True then begin data_stream.Position:=0; data_list.LoadFromStream(data_stream); RvfData:=data_list.Text; end else begin ShowMessage('Sorry, the formatted text could not be added to the sketchboard file.' +#13+#13+'You may wish to save it in a separate file.'); sb_rvf_outer_form.save_menu_entry.Click; end; Invalidate; PreserveAspect:=True; // lock again finally data_list.Free; formatted_txt_metafile.Free; emf_stream.Free; data_stream.Free; Screen.Cursor:=crDefault; end;//try end;//if ModalResult end;//if RvfShape end;//with shape end;//if metafile end;//with sb_rich_form dtp_document.EndUpdate; end;//with dtp_form end; //______________________________________________________________________________ procedure Tdtp_settings_form.sb_font_colour_buttonClick(Sender: TObject); var colour:TColor; i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; colour:=sb_font_colour_panel.Color; colour:=get_colour('choose a font colour',colour); sb_font_colour_panel.Color:=colour; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpTextBaseShape) then TdtpTextBaseShape(selected_shapes_list[i]).FontColor:=colour; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.outline_width_editExit(Sender:TObject); var i:integer; box_value:extended; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; if sb_check_valid_float(outline_width_edit,0.1,100,box_value)=False then EXIT; // input limits 0.1mm - 100mm dtp_document.BeginUpdate; // in case multiple shapes for i:=0 to selected_shapes_list.Count-1 do begin // selected shape, or all selected if (TdtpShape(selected_shapes_list[i]) is TdtpPolygonShape) then TdtpPolygonShape(selected_shapes_list[i]).OutlineWidth:=box_value_sb_wide(box_value); end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.fill_transparency_trackbarChange(Sender:TObject); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; FFillAlpha:=fill_transparency_trackbar.Position; // global for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpPolygonShape) then begin with TdtpPolygonShape(selected_shapes_list[i]) do begin NextUndoNoRepeatedPropertyChange; FillAlpha:=fill_transparency_trackbar.Position; end;//with end; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.multi_line_text_memoExit(Sender: TObject); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpMemoShape) then TdtpMemoShape(selected_shapes_list[i]).Text:=multi_line_text_memo.Text; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.sb_word_wrap_memo_checkboxClick(Sender:TObject); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpMemoShape) then TdtpMemoShape(selected_shapes_list[i]).WordWrap:=sb_word_wrap_memo_checkbox.Checked; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.line_width_editExit(Sender:TObject); var i:integer; box_value:extended; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; if sb_check_valid_float(line_width_edit,0.1,1000,box_value)=False then EXIT; // input limits 0.1mm - 1000mm dtp_document.BeginUpdate; // in case multiple shapes for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpLineShape) then TdtpLineShape(selected_shapes_list[i]).LineWidth:=box_value_sb_wide(box_value); end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.arrow1_comboChange(Sender:TObject); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; // Avoid invalid index if (arrow1_combo.ItemIndex<0) or (arrow1_combo.ItemIndex>arrow1_combo.Items.Count-1) then EXIT; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpLineShape) then TdtpLineShape(selected_shapes_list[i]).Arrows[0].Style:=TdtpArrowStyle(arrow1_combo.ItemIndex); end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.arrow2_comboChange(Sender:TObject); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; // Avoid invalid index if (arrow2_combo.ItemIndex<0) or (arrow2_combo.ItemIndex>arrow2_combo.Items.Count-1) then EXIT; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpLineShape) then TdtpLineShape(selected_shapes_list[i]).Arrows[1].Style:=TdtpArrowStyle(arrow2_combo.ItemIndex); end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.edArrow1WidthExit(Sender:TObject); var i:integer; box_value:extended; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; if sb_check_valid_float(edArrow1Width,0.1,1000,box_value)=False then EXIT; // input limits 0.1mm - 1000mm dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpLineShape) then TdtpLineShape(selected_shapes_list[i]).Arrows[0].Width:=box_value_sb_wide(box_value); end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.edArrow2WidthExit(Sender:TObject); var i:integer; box_value:extended; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; if sb_check_valid_float(edArrow2Width,0.1,1000,box_value)=False then EXIT; // input limits 0.1mm - 1000mm dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpLineShape) then TdtpLineShape(selected_shapes_list[i]).Arrows[1].Width:=box_value_sb_wide(box_value); end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure {TfrLineShape.} Tdtp_settings_form.edArrow1LengthExit(Sender:TObject); var i:integer; box_value:extended; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; if sb_check_valid_float(edArrow1Length,0.1,1000,box_value)=False then EXIT; // input limits 0.1mm - 1000mm dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpLineShape) then TdtpLineShape(selected_shapes_list[i]).Arrows[0].Length:=box_value_sb_wide(box_value); end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.edArrow2LengthExit(Sender:TObject); var i:integer; box_value:extended; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; if sb_check_valid_float(edArrow2Length,0.1,1000,box_value)=False then EXIT; // input limits 0.1mm - 1000mm dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpLineShape) then TdtpLineShape(selected_shapes_list[i]).Arrows[1].Length:=box_value_sb_wide(box_value); end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.corner_radius_editExit(Sender:TObject); var i:integer; box_value:extended; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; if sb_check_valid_float(corner_radius_edit,0,50,box_value)=False then EXIT; // input limits 0-50% dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is Tdtp85aNewRoundRectShape) then Tdtp85aNewRoundRectShape(selected_shapes_list[i]).CornerRadius:=box_value; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.perspective_text_checkboxClick(Sender:TObject); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpCurvedText) then begin if perspective_text_checkbox.Checked=True then TdtpCurvedText(selected_shapes_list[i]).TransformMethod:=tmPoints else TdtpCurvedText(selected_shapes_list[i]).TransformMethod:=tmGlyphs; end; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.curved_text_angle_editExit(Sender:TObject); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if (TdtpShape(selected_shapes_list[i]) is TdtpCurvedText) then TdtpCurvedText(selected_shapes_list[i]).CurveAngle:=StrToFloat(curved_text_angle_edit.Text); end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.FormDestroy(Sender:TObject); var n:integer; begin selected_shapes_list.Free; deleted_shapes_list.Free; // 205e font_list.Free; if outline_markers_list.Count>0 // 212a... then for n:=0 to outline_markers_list.Count-1 do Tmarker(outline_markers_list.Objects[n]).Free; outline_markers_list.Clear; outline_markers_list.Free; end; //______________________________________________________________________________ procedure Tdtp_settings_form.FormResize(Sender: TObject); begin if no_onresize=True then EXIT; dtp_settings_panel.Width:=ClientWidth; control_panel_page_control.width:=dtp_settings_panel.Width; end; //______________________________________________________________________________ procedure Tdtp_settings_form.FormKeyDown(Sender:TObject; var Key:Word; Shift:TShiftState); begin if (Key=VK_RETURN) and (ActiveControl<>multi_line_text_memo) then begin sb_ok_button.SetFocus; Key:=0; end; if Key=VK_F2 // OK button then begin sb_ok_button.Click; Key:=0; end; if ( (Key=VK_ADD) and (Shift=[]) ) or ( (key=Word(VkKeyScan('='))) and (Shift=[ssShift,ssCtrl]) ) // numpad + key or Shift+Ctrl+= then begin dtp_form.zoom_in_menu_entry.Click; Key:=0; end; if ( (Key=VK_SUBTRACT) and (Shift=[]) ) or ( (key=Word(VkKeyScan('-'))) and (Shift=[ssShift,ssCtrl]) ) // numpad - key or Shift+Ctrl+- then begin dtp_form.zoom_out_menu_entry.Click; Key:=0; end; if Key=VK_PAUSE then Application.Minimize; // hide TEMPLOT on PAUSE key. end; //______________________________________________________________________________ procedure Tdtp_settings_form.multi_line_text_ok_buttonClick(Sender:TObject); begin sb_ok_button.SetFocus; end; //______________________________________________________________________________ procedure Tdtp_settings_form.auto_add_radiobuttonClick(Sender:TObject); begin pad_form.sb_auto_add_menu_entry.Click; // radio item end; //______________________________________________________________________________ // set manual buttons ... procedure Tdtp_settings_form.manual_add_radiobuttonClick(Sender:TObject); begin pad_form.sb_manual_add_menu_entry.Click; // radio item end; //______________________________________________________________________________ procedure Tdtp_settings_form.lock_radiobuttonClick(Sender: TObject); begin pad_form.sb_lock_menu_entry.Click; // radio item end; //______________________________________________________________________________ procedure Tdtp_settings_form.auto_update_diagram_checkboxClick(Sender:TObject); // duplicated on pad menu ... begin pad_form.auto_update_diagram_menu_entry.Checked:=auto_update_diagram_checkbox.Checked; end; //______________________________________________________________________________ procedure Tdtp_settings_form.manual_add_diagram_checkboxClick(Sender:TObject); // duplicated on pad menu ... begin pad_form.manual_add_diagram_menu_entry.Checked:=manual_add_diagram_checkbox.Checked; end; //______________________________________________________________________________ procedure Tdtp_settings_form.manual_add_update_checkboxClick(Sender:TObject); // duplicated on pad menu ... begin pad_form.manual_add_update_menu_entry.Checked:=manual_add_update_checkbox.Checked; end; //______________________________________________________________________________ procedure Tdtp_settings_form.include_grid_checkboxClick(Sender:TObject); // duplicated on pad menu ... begin pad_form.sb_include_grid_menu_entry.Checked:=include_grid_checkbox.Checked; end; //______________________________________________________________________________ procedure Tdtp_settings_form.include_grid_labels_checkboxClick(Sender:TObject); begin pad_form.sb_include_grid_labels_menu_entry.Checked:=include_grid_labels_checkbox.Checked; end; //______________________________________________________________________________ procedure Tdtp_settings_form.include_picture_shapes_checkboxClick(Sender: TObject); begin pad_form.sb_include_picture_shapes_menu_entry.Checked:=include_picture_shapes_checkbox.Checked; include_picture_borders_checkbox.Enabled:=include_picture_shapes_checkbox.Checked; // 205a end; //______________________________________________________________________________ procedure Tdtp_settings_form.hide_tab_sheetShow(Sender: TObject); begin shrink_tab_sheets; trackplan_colours_label.Visible:=False; end; //______________________________________________________________________________ procedure Tdtp_settings_form.sb_ok_buttonClick(Sender: TObject); begin shrink_tab_sheets; trackplan_colours_label.Visible:=False; end; //______________________________________________________________________________ procedure Tdtp_settings_form.settings_tab_sheetShow(Sender: TObject); begin expand_tab_sheets; trackplan_colours_label.Visible:=False; end; //______________________________________________________________________________ procedure Tdtp_settings_form.page_tab_sheetShow(Sender: TObject); begin expand_tab_sheets; trackplan_colours_label.Visible:=False; end; //______________________________________________________________________________ procedure Tdtp_settings_form.modify_item_tab_sheetShow(Sender: TObject); begin expand_tab_sheets; trackplan_colours_label.Visible:=False; end; //______________________________________________________________________________ procedure Tdtp_settings_form.add_tab_sheetShow(Sender: TObject); begin expand_tab_sheets; trackplan_colours_label.Visible:=False; end; //______________________________________________________________________________ procedure Tdtp_settings_form.trackplan_tab_sheetShow(Sender: TObject); begin expand_tab_sheets; trackplan_colours_label.Visible:=True; end; //______________________________________________________________________________ procedure Tdtp_settings_form.size_updownClick(Sender:TObject; Button:TUDBtnType); begin no_onresize:=True; // don't permit on-resize until finished. if size_updown.Position>size_updown.Tag // ! position goes up, size goes down. then ScaleBy(9,10); // scale the form contents down. if size_updown.Position allow all items to be selected`1 menu item.' +'||green_panel_begintree.gif The `0no select !`1 option is useful if you have a large background image and wish to work over it without accidentally selecting it.' +'||Make sure you have scaled and positioned it as you want it before ticking this option.green_panel_end', '','','','','no - cancel','yes - continue',0); sb_no_select_msg_pref:=alert_box.preferences_checkbox.Checked; alert_box.preferences_checkbox.Visible:=False; if i=5 then begin no_select_checkbox.Checked:=False; EXIT; end; end; dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin TdtpShape(selected_shapes_list[i]).AllowSelect:= NOT no_select_checkbox.Checked; end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.no_update_checkboxClick(Sender: TObject); var i:integer; dtp_shape_tag:Tdtp_shape_tag; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; try for i:=0 to selected_shapes_list.Count-1 do begin dtp_shape_tag:=Tdtp_shape_tag(TdtpShape(selected_shapes_list[i]).Tag); dtp_shape_tag.no_update:=no_update_checkbox.Checked; TdtpShape(selected_shapes_list[i]).Tag:=integer(dtp_shape_tag); end;//next finally dtp_document.EndUpdate; end;//try end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.ref_checkboxClick(Sender: TObject); // 227a var i:integer; dtp_shape_tag:Tdtp_shape_tag; begin if selected_shapes_list.Count<>1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; dtp_document.BeginUpdate; try for i:=0 to dtp_document.CurrentPage.ShapeCount-1 do begin // first clear any existing reference item dtp_shape_tag:=Tdtp_shape_tag(dtp_document.CurrentPage.Shapes[i].Tag); dtp_shape_tag.reference:=False; dtp_document.Shapes[i].Tag:=integer(dtp_shape_tag); end;//next dtp_shape_tag:=Tdtp_shape_tag(TdtpShape(selected_shapes_list[0]).Tag); // set or unset this one dtp_shape_tag.reference:=ref_checkbox.Checked; TdtpShape(selected_shapes_list[0]).Tag:=integer(dtp_shape_tag); finally dtp_document.EndUpdate; end;//try end;//with form end; //______________________________________________________________________________ procedure Tdtp_settings_form.update_items_buttonClick(Sender: TObject); begin sb_update_all_items(False); end; //______________________________________________________________________________ procedure Tdtp_settings_form.item_name_editExit(Sender: TObject); var i:integer; begin if selected_shapes_list.Count<1 then EXIT; with dtp_form do begin if updating_now=True then EXIT; // all selected shapes get the same name ... dtp_document.BeginUpdate; for i:=0 to selected_shapes_list.Count-1 do begin if check_track_plan(TdtpShape(selected_shapes_list[i]).Name)=True // but not trackplans then CONTINUE; TdtpShape(selected_shapes_list[i]).Name:=item_name_edit.Text; // item name // and into mouseover hint if not empty ... TdtpShape(selected_shapes_list[i]).Hint:=item_name_edit.Text; TdtpShape(selected_shapes_list[i]).ShowHint:=(item_name_edit.Text<>''); end;//next dtp_document.EndUpdate; end;//with form end; //______________________________________________________________________________ procedure do_copyright(in_shape:TdtpShape); // create or update the copyright notice ... var i:integer; copyright_shape_exists:boolean; copyright_shape:TdtpTextShape; copy_str:string; dtp_shape_tag:Tdtp_shape_tag; begin if in_shape is TdtpBitmapShape then begin copy_str:=TdtpBitmapShape(in_shape).copyright_str; if copy_str<>'' then begin copy_str:=StringReplace(copy_str,'_',' ',[rfReplaceAll, rfIgnoreCase]); // underscores to spaces copyright_shape_exists:=False; // init with dtp_form.dtp_document.CurrentPage do begin if ShapeCount>0 then begin for i:=0 to (ShapeCount-1) do begin if Tdtp_shape_tag(Shapes[i].Tag).copyright_mark=False then CONTINUE; // not the copyright text shape copyright_shape_exists:=True; if Shapes[i] is TdtpTextShape // double check then begin if Pos(copy_str,TdtpTextShape(Shapes[i]).Text)<>0 then BREAK; // already in text. TdtpTextShape(Shapes[i]).Text:=Trim(TdtpTextShape(Shapes[i]).Text)+' | '+copy_str+' '; // add the copyright string for this one end; BREAK; end;//next end; end;//with if copyright_shape_exists=False // need to create it then begin dtp_shape_tag.no_update:=True; // no updating to track plan dtp_shape_tag.copyright_mark:=True; // flag this dtp_shape_tag.zooming_rectangle:=False; // complete the Tag dtp_shape_tag.reference:=False; copyright_shape:=TdtpTextShape.Create; copyright_shape.Tag:=integer(dtp_shape_tag); copyright_shape.Text:='This drawing contains images © '+copy_str+' '; // 6 extra spaces because auto-size is not reliable copyright_shape.FontName:='Times New Roman'; copyright_shape.FontHeight:=3; // mm arbitrary copyright_shape.FontColor:=$00404040; // dark grey copyright_shape.DocLeft:=1; // mm arbitrary copyright_shape.DocTop:=dtp_form.dtp_document.CurrentPage.PageHeight-4; // mm arbitrary dtp_form.dtp_document.CurrentPage.ShapeAdd(copyright_shape); end; end;//if copyright_str end;//if bitmap end; //______________________________________________________________________________ procedure add_bitmap_image(dropped_file_str:string); // Add a bitmap shape var added_bitmap:TdtpBitmapShape; file_str,file_name_str,pf_str:string; image_width,image_height:integer; n,n1,n2,i:integer; image_scale:integer; metric_factor:extended; ///////////////////////////////////////////////////////////// procedure do_drag_insert; begin added_bitmap.pixels_per_ft:=18; // unused default // 85A addition to TdtpBitmapShape if trackplan_exists=True then ShowMessage('No auto sizing data is available for this image.'+#13+#13+'Please click and drag a rectangle to contain it.') else ShowMessage('This image cannot be auto-sized because there is no trackplan on the sketchboard.'+#13+#13+'Please click and drag a rectangle to contain the image.'); dtp_form.dtp_document.InsertShapeByDrag(added_bitmap); end; ///////////////////////////////////////////////////////////// begin added_bitmap:=nil; file_name_str:=''; // init name part file_str:=''; // init full path and name update_model_rulers; // make sure we have current trackplan data if dropped_file_str='' // add image button clicked then begin with dtp_settings_form.bitmap_load_dialog do begin if his_load_bitmap_path='' then InitialDir:=exe_str+'SKETCHBOARD-IMAGE-LIB\' else InitialDir:=his_load_bitmap_path; FileName:=''; if Execute=True then file_str:=FileName else EXIT; end;//with end else file_str:=dropped_file_str; // image file dropped 214a added_bitmap:=TdtpBitmapShape.Create; try added_bitmap.Image.LoadFromFile(file_str); file_name_str:=ExtractFileName(file_str); added_bitmap.file_name:=file_name_str; // 85A addition to TdtpBitmapShape except ShowMessage('Image file error. Valid file formats are PNG, GIF, JPG, BMP.'); added_bitmap.Free; EXIT; end;//try if added_bitmap=nil then EXIT; his_load_bitmap_path:=ExtractFilePath(file_str); // for next time. image_width:=added_bitmap.Image.Bitmap.Width; // pixels image_height:=added_bitmap.Image.Bitmap.Height; // find copyright string in file name ...a1a_joe_blogs_z2z... n1:=Pos('a1a_',file_name_str); n2:=Pos('_z2z',file_name_str); if (n1<>0) and (n2<>0) then added_bitmap.copyright_str:=UpperCase(Copy(file_name_str,n1+4,n2-n1-4)) else added_bitmap.copyright_str:=''; // find pixels per ft ... n:=Pos('_pf',file_name_str); metric_factor:=100; // init pf = pixels per 100ft if n=0 then begin n:=Pos('_pm',file_name_str); metric_factor:=100000/304.8; // pm = pixels per 100m end; i:=Pos('.',file_name_str); if (n=0) or (i=0) or (i<(n+4)) or (trackplan_exists=False) then begin do_drag_insert; EXIT; end; pf_str:=Copy(file_name_str,n+3,i-n-3); try image_scale:=StrToInt(pf_str); // pixels per 100ft or 100 metres except do_drag_insert; EXIT; end;//try if image_scale<1 // no neg or div by zero then begin do_drag_insert; EXIT; end; added_bitmap.pixels_per_ft:=image_scale/metric_factor; // 85A addition to TdtpBitmapShape added_bitmap.DocWidth:=metric_factor*image_width*pad_model_scale*stretch_factor_wide/image_scale; added_bitmap.DocHeight:=metric_factor*image_height*pad_model_scale*stretch_factor_high/image_scale; // insert at centre of current view... with dtp_form.dtp_document do begin added_bitmap.DocLeft:=WindowLeft+(CurrentPage.PageWidth*100/ZoomPercent)/2-added_bitmap.DocWidth/2; added_bitmap.DocTop:=WindowTop+(CurrentPage.PageHeight*100/ZoomPercent)/2-added_bitmap.DocHeight/2; end;//with added_bitmap.PreserveAspect:=True; added_bitmap.AllowSelect:=True; dtp_form.dtp_document.CurrentPage.ShapeAdd(added_bitmap); do_copyright(added_bitmap); end; //______________________________________________________________________________ procedure Tdtp_settings_form.image_bitbuttonClick(Sender: TObject); begin add_bitmap_image(''); // '' = file from dialog, not dropped end; //______________________________________________________________________________ procedure Tdtp_settings_form.paste_image_bitbuttonClick(Sender: TObject); // paste a bitmap shape from clipboard var added_bitmap:TdtpBitmapShape; clipbd_stream:TMemoryStream; clipbd_png:TPNGObject; begin if Clipboard.HasFormat(CF_BITMAP) then begin added_bitmap:=nil; update_model_rulers; // make sure we have current trackplan data added_bitmap:=TdtpBitmapShape.Create; added_bitmap.PreserveAspect:=True; added_bitmap.AllowSelect:=True; added_bitmap.pixels_per_ft:=1; // not used added_bitmap.copyright_str:=''; added_bitmap.file_name:='(pasted image)'; // 85A additions to TdtpBitmapShape clipbd_stream:=TMemoryStream.Create; clipbd_png:=TPNGObject.Create; try clipbd_png.LoadFromClipBoardFormat(CF_BITMAP,ClipBoard.GetAsHandle(CF_BITMAP),0); // load clipboard to PNG clipbd_png.SaveToStream(clipbd_stream); // and sdave to sream in PNG format clipbd_stream.Position:=0; added_bitmap.Image.LoadFromStream(clipbd_stream,'.png',0); // load into shape except ShowMessage('Sorry, unable to paste image.'); added_bitmap.Free; clipbd_stream.Free; clipbd_png.Free; EXIT; end;//try clipbd_stream.Free; clipbd_png.Free; end else begin ShowMessage('No image is available for pasting.'+#13+#13+'You must first copy an image before using this function.'); EXIT; end; if added_bitmap=nil then EXIT; dtp_form.dtp_document.InsertShapeByDrag(added_bitmap); end; //______________________________________________________________________________ procedure Tdtp_settings_form.scan_image_bitbuttonClick(Sender: TObject); // acquire a bitmap shape from scanner var added_bitmap:TdtpBitmapShape; scan_stream:TMemoryStream; scan_png:TPNGObject; scan_bmp:TBitmap; begin scan_bmp:=TBitmap.Create; if do_twain(scan_bmp)=True then begin added_bitmap:=nil; update_model_rulers; // make sure we have current trackplan data added_bitmap:=TdtpBitmapShape.Create; added_bitmap.PreserveAspect:=True; added_bitmap.AllowSelect:=True; added_bitmap.pixels_per_ft:=1; // not used added_bitmap.copyright_str:=''; added_bitmap.file_name:='(scanned image)'; // 85A additions to TdtpBitmapShape scan_stream:=TMemoryStream.Create; scan_png:=TPNGObject.Create; try scan_png.Assign(scan_bmp); scan_png.SaveToStream(scan_stream); // and save to stream in PNG format scan_stream.Position:=0; added_bitmap.Image.LoadFromStream(scan_stream,'.png',0); // load into shape except ShowMessage('Sorry, unable to use the scanned image.'); added_bitmap.Free; scan_stream.Free; scan_png.Free; scan_bmp.Free; EXIT; end;//try scan_stream.Free; scan_png.Free; scan_bmp.Free; end else begin ShowMessage('No scanned image is available for the sketchboard.'+#13+#13+'If you did not cancel scanning, check that your scanner is switched on and working.'); scan_bmp.Free; EXIT; end; if added_bitmap=nil then EXIT; dtp_form.dtp_document.InsertShapeByDrag(added_bitmap); end; //______________________________________________________________________________ procedure Tdtp_settings_form.rectangle_bitbuttonClick(Sender: TObject); var added_rectangle:Tdtp85aRectangleShape; begin added_rectangle:=Tdtp85aRectangleShape.Create; SetPolygonShapeDefaults(added_rectangle); dtp_form.dtp_document.InsertShapeByDrag(added_rectangle); end; //______________________________________________________________________________ procedure Tdtp_settings_form.square_bitbuttonClick(Sender: TObject); var added_square:TdtpSquareShape; begin added_square:=TdtpSquareShape.Create; SetPolygonShapeDefaults(added_square); added_square.DocWidth:=50; // force height=width, 50 arbitrary added_square.DocHeight:=50; added_square.PreserveAspect:=True; // and keep it square added_square.FillColor:=$008000FF; // mauve dtp_form.dtp_document.InsertShapeByDrag(added_square); end; //______________________________________________________________________________ procedure Tdtp_settings_form.single_text_bitbuttonClick(Sender: TObject); // Add a text shape var added_text_shape:TdtpTextShape; begin added_text_shape:=TdtpTextShape.Create; added_text_shape.Text:='one-line plain text item - click on the actual characters to select '; // Dtp bug - spaces added too ensure outline is wide enough added_text_shape.ShowHint:=True; added_text_shape.Hint:=' click on the actual characters to select this item, not the spaces between them '; added_text_shape.FontName:='Times New Roman'; added_text_shape.FontHeight:=4; // page mm arbitrary added_text_shape.FontColor:=clBlue; added_text_shape.AutoSize:=True; // required True to click add without dragging added_text_shape.AllowEdit:=False; // no double-click editing dtp_form.dtp_document.InsertShapeByClick(added_text_shape); end; //______________________________________________________________________________ procedure Tdtp_settings_form.multi_text_bitbuttonClick(Sender: TObject); // Add a memo shape var added_memo:TdtpPolygonMemo; begin added_memo:=TdtpPolygonMemo.Create; added_memo.Lines.Text:='multi-line plain text item' +#13+#13+'For formatted text add a formatted text block instead.' +#13+#13+'If this item is rotated, click on the actual characters to select it.' +#13+#13+'The lines will wrap if the outline size is changed.'; added_memo.ShowHint:=True; added_memo.Hint:=' multi-line plain text '; added_memo.FontName:='Times New Roman'; added_memo.FontHeight:=4; // page mm arbitrary added_memo.FontColor:=clBlue; added_memo.WordWrap:=True; added_memo.AutoSize:=False; // required True to click add without dragging added_memo.AllowEdit:=False; // no double-click editing dtp_form.dtp_document.InsertShapeByDrag(added_memo); end; //______________________________________________________________________________ procedure Tdtp_settings_form.round_rect_bitbuttonClick(Sender: TObject); // 216a var added_round_rectangle:Tdtp85aNewRoundRectShape; // 216a corner is radius % short side begin added_round_rectangle:=Tdtp85aNewRoundRectShape.Create; SetPolygonShapeDefaults(added_round_rectangle); added_round_rectangle.FillColor:=$00FF8000; // sea blue added_round_rectangle.DocWidth:=50; // to allow corner radius to be set.. added_round_rectangle.DocHeight:=50; added_round_rectangle.CornerRadius:=20; // % dtp_form.dtp_document.InsertShapeByDrag(added_round_rectangle); end; //______________________________________________________________________________ procedure Tdtp_settings_form.quadrangle_bitbuttonClick(Sender: TObject); var added_quadrangle:TdtpQuadrangleShape; begin added_quadrangle:=TdtpQuadrangleShape.Create; SetPolygonShapeDefaults(added_quadrangle); added_quadrangle.FillColor:=$00C0E0FF; added_quadrangle.DocWidth:=50; // to allow margin size to be set.. added_quadrangle.DocHeight:=50; added_quadrangle.InnerSize:=20.0; // frame margin 20% dtp_form.dtp_document.InsertShapeByDrag(added_quadrangle); end; //______________________________________________________________________________ procedure Tdtp_settings_form.enclosure_bitbuttonClick(Sender: TObject); var added_cap:TdtpCapShape; begin added_cap:=TdtpCapShape.Create; SetPolygonShapeDefaults(added_cap); added_cap.FillColor:=$00C0FFE0; added_cap.DocWidth:=50; // to allow margin size to be set.. added_cap.DocHeight:=50; added_cap.InnerSize:=5.0; // frame margin 5% dtp_form.dtp_document.InsertShapeByDrag(added_cap); end; //______________________________________________________________________________ procedure Tdtp_settings_form.circle_bitbuttonClick(Sender: TObject); var added_circle:Tdtp85aEllipseShape; begin added_circle:=Tdtp85aEllipseShape.Create; SetPolygonShapeDefaults(added_circle); added_circle.FillColor:=clYellow; added_circle.DocWidth:=50; // fix aspect ratio for a circle added_circle.DocHeight:=50; added_circle.PreserveAspect:=True; dtp_form.dtp_document.InsertShapeByDrag(added_circle); end; //______________________________________________________________________________ procedure Tdtp_settings_form.elipse_bitbuttonClick(Sender: TObject); var added_ellipse:Tdtp85aEllipseShape; begin added_ellipse:=Tdtp85aEllipseShape.Create; SetPolygonShapeDefaults(added_ellipse); added_ellipse.FillColor:=clLime; dtp_form.dtp_document.InsertShapeByDrag(added_ellipse); end; //______________________________________________________________________________ procedure Tdtp_settings_form.arc_bitbuttonClick(Sender: TObject); var added_arc:TdtpFilledArcShape; begin added_arc:=TdtpFilledArcShape.Create; SetPolygonShapeDefaults(added_arc); added_arc.FillColor:=$00FF0080; // violet dtp_form.dtp_document.InsertShapeByDrag(added_arc); end; //______________________________________________________________________________ procedure Tdtp_settings_form.corner_bitbuttonClick(Sender: TObject); var added_corner:TdtpCornerShape; begin added_corner:=TdtpCornerShape.Create; SetPolygonShapeDefaults(added_corner); with added_corner do begin UseFill:=True; FillColor:=$000050C0; // brick red UseOutline:=False; InnerRad:=67; // % of outer rad end;//with dtp_form.dtp_document.InsertShapeByDrag(added_corner); end; //______________________________________________________________________________ procedure Tdtp_settings_form.segment_bitbuttonClick(Sender: TObject); var added_segment:TdtpSegmentShape; begin added_segment:=TdtpSegmentShape.Create; SetPolygonShapeDefaults(added_segment); added_segment.FillColor:=clAqua; dtp_form.dtp_document.InsertShapeByDrag(added_segment); end; //______________________________________________________________________________ procedure Tdtp_settings_form.triangle_bitbuttonClick(Sender: TObject); var added_triangle:TdtpTriangleShape; begin added_triangle:=TdtpTriangleShape.Create; SetPolygonShapeDefaults(added_triangle); added_triangle.FillColor:=$000080FF; // orange dtp_form.dtp_document.InsertShapeByDrag(added_triangle); end; //______________________________________________________________________________ procedure Tdtp_settings_form.ring_bitbuttonClick(Sender: TObject); var added_ring:TdtpRingShape; begin added_ring:=TdtpRingShape.Create; SetPolygonShapeDefaults(added_ring); added_ring.DocWidth:=50; // fix aspect ratio for a circular ring added_ring.DocHeight:=50; added_ring.PreserveAspect:=True; added_ring.FillColor:=clRed; dtp_form.dtp_document.InsertShapeByDrag(added_ring); end; //______________________________________________________________________________ procedure Tdtp_settings_form.arrow_bitbuttonClick(Sender: TObject); var added_line:TdtpLineShape; begin added_line:=TdtpLineShape.Create; with added_line do begin UseFill:=True; FillColor:=clRed; UseOutline:=False; if trackplan_exists=True then LineWidth:=pad_model_scale*stretch_factor_wide*2 // line width is 2ft scale width at trackplan scale else LineWidth:=1.0; // mm on page Arrows[0].Width:=LineWidth*4; Arrows[0].Length:=LineWidth*6; Arrows[0].Style:=TdtpArrowStyle(0); // no arrow Arrows[1].Width:=LineWidth*4; Arrows[1].Length:=LineWidth*6; Arrows[1].Style:=TdtpArrowStyle(1); // plain arrow end;//with dtp_form.dtp_document.InsertShapeByDrag(added_line); end; //______________________________________________________________________________ procedure Tdtp_settings_form.line_bitbuttonClick(Sender: TObject); var added_line:TdtpLineShape; begin added_line:=TdtpLineShape.Create; with added_line do begin UseFill:=True; FillColor:=$0000C000; // mid-green UseOutline:=False; if trackplan_exists=True then LineWidth:=pad_model_scale*stretch_factor_wide*2 // line width is 2ft scale width at trackplan scale else LineWidth:=1.0; // mm on page Arrows[0].Width:=LineWidth*4; Arrows[0].Length:=LineWidth*6; Arrows[0].Style:=TdtpArrowStyle(0); // no arrow Arrows[1].Width:=LineWidth*4; Arrows[1].Length:=LineWidth*6; Arrows[1].Style:=TdtpArrowStyle(0); // no arrow end;//with dtp_form.dtp_document.InsertShapeByDrag(added_line); end; //______________________________________________________________________________ procedure add_freehand_shape(patch:boolean); // Add a freehand shape var added_freehand:TdtpFreehandShape; begin freehand_mode:=1; // free drawing freehand_patch:=patch; // global added_freehand:=TdtpFreehandShape.Create; SetPolygonShapeDefaults(added_freehand); added_freehand.UseFill:=patch; added_freehand.UseOutline:= NOT patch; added_freehand.FillColor:=$0000FF80; if freehand_line_width=0 // use default then added_freehand.OutlineWidth:=1.0/dtp_form.dtp_document.ScreenDpm // 1 pixel wide at screen res (arbitrary after trial and error) else begin added_freehand.OutlineWidth:=freehand_line_width; added_freehand.OutlineColor:=clGray; // paler for thick lines end; with dtp_form.dtp_document do begin added_freehand.Recording:=True; InsertShapeByClick(added_freehand); end;//with end; //______________________________________________________________________________ procedure Tdtp_settings_form.free_patch_bitbuttonClick(Sender: TObject); begin add_freehand_shape(True); end; //______________________________________________________________________________ procedure Tdtp_settings_form.free_lines_bitbuttonClick(Sender: TObject); begin add_freehand_shape(False); end; //______________________________________________________________________________ procedure add_metafile_image(dropped_file_str:string); // 214a // Add a metafile shape var added_metafile:TdtpExposedMetafile; file_str:string; begin added_metafile:=nil; file_str:=''; // init full path and name if dropped_file_str='' // add image button clicked then begin with dtp_settings_form.metafile_load_dialog do begin if his_load_metafile_path='' then InitialDir:=exe_str+'EMF-FILES\' else InitialDir:=his_load_metafile_path; FileName:=''; if Execute=True then file_str:=FileName else EXIT; end;//with end else file_str:=dropped_file_str; // image file dropped 214a added_metafile:=TdtpExposedMetafile.Create; added_metafile.RvfShape:=False; // 85A not a formatted text metafile try added_metafile.Image.LoadFromFile(file_str); if dropped_file_str<>'' then show_modal_message('Please click and drag a rectangle to contain the dropped metafile image.'); dtp_form.dtp_document.InsertShapeByDrag(added_metafile); except show_modal_message('Metafile error. Valid file formats are EMF, WMF.'); added_metafile.Free; EXIT; end;//try if added_metafile=nil then EXIT; his_load_metafile_path:=ExtractFilePath(file_str); // for next time. end; //______________________________________________________________________________ procedure add_metafile_streamed; // 226e // Add a metafile shape from a stream var added_metafile:TdtpExposedMetafile; str:string; begin added_metafile:=nil; // init.. str:=''; added_metafile:=TdtpExposedMetafile.Create; added_metafile.RvfShape:=False; // 85A not a formatted text metafile try metafile_stream.Position:=0; added_metafile.Image.LoadFromStream(metafile_stream,str); show_modal_message('Please click and drag a rectangle to contain the metafile image.'); dtp_form.dtp_document.InsertShapeByDrag(added_metafile); except show_modal_message('error: Metafile failed to load.'); added_metafile.Free; end;//try end; //______________________________________________________________________________ procedure Tdtp_settings_form.metafile_bitbuttonClick(Sender: TObject); begin if emf_streamed=True then begin if alert(4,' metafile from memory ?', 'There is a metafile in memory. Do you want to add it to the sketchboard ?' +'||Or obtain a metafile from a file ?', '','','','add from memory','','obtain from a file',0)=4 then begin add_metafile_streamed; EXIT; end; end; add_metafile_image(''); // '' = get from file dialog, not dropped file end; //______________________________________________________________________________ procedure Tdtp_settings_form.sb_help_buttonClick(Sender: TObject); const url_str:string='https://85a.uk/templot/club/'; sb_help_str:string='php/590 `0Using the sketchboard`9' +'||temporary notes:' +'||Please click more information online, or refer to the sketchboard discussions on the Templot Club forum -- click the button below.'; begin if help(0,sb_help_str,'visit the Templot Club web site')=1 then begin if ShellExecute(0,'open',PChar(url_str),nil,nil,SW_SHOWNORMAL)<=32 then begin alert(2,' connection failed', 'Sorry, unable to open your browser window and connect to the Templot Club web site.', '','','','','','continue',0); end; end; end; //______________________________________________________________________________ procedure Tdtp_settings_form.curved_text_bitbuttonClick(Sender: TObject); var added_ctext_shape:TdtpCurvedText; begin added_ctext_shape:=TdtpCurvedText.Create; added_ctext_shape.Text:='curved text item'; added_ctext_shape.ShowHint:=True; added_ctext_shape.Hint:=' curved text '; added_ctext_shape.FontName:='Times New Roman'; added_ctext_shape.FontHeight:=6; // mm arbitrary added_ctext_shape.FontColor:=clRed; added_ctext_shape.AutoSize:=True; // required True to click add without dragging added_ctext_shape.AllowEdit:=False; // no double-click editing added_ctext_shape.CurveAngle:=20; dtp_form.dtp_document.InsertShapeByClick(added_ctext_shape); end; //______________________________________________________________________________ procedure Tdtp_settings_form.wavy_text_bitbuttonClick(Sender: TObject); // Add a wavy text var added_wavy_shape:TdtpWavyText; begin added_wavy_shape:=TdtpWavyText.Create; added_wavy_shape.Text:='wavy text item'; added_wavy_shape.ShowHint:=True; added_wavy_shape.Hint:=' wavy text '; added_wavy_shape.WaveX.WaveLength:=20; added_wavy_shape.WaveX.Amplitude:=2; added_wavy_shape.FontName:='Times New Roman'; added_wavy_shape.FontHeight:=6; // mm arbitrary added_wavy_shape.FontColor:=clRed; added_wavy_shape.AutoSize:=True; // required True to click add without dragging added_wavy_shape.AllowEdit:=False; // no double-click editing dtp_form.dtp_document.InsertShapeByClick(added_wavy_shape); end; //______________________________________________________________________________ procedure Tdtp_settings_form.distorted_text_bitbuttonClick(Sender: TObject); // Add a projective text shape var added_distorted_shape:TdtpProjectiveText; begin added_distorted_shape:=TdtpProjectiveText.Create; added_distorted_shape.Text:='distorted text item'; added_distorted_shape.ShowHint:=True; added_distorted_shape.Hint:=' distorted text '; added_distorted_shape.FontName:='Times New Roman'; added_distorted_shape.FontHeight:=6; // mm arbitrary added_distorted_shape.FontColor:=clBlue; added_distorted_shape.AutoSize:=False; // required True to click add without dragging added_distorted_shape.AllowEdit:=False; // no double-click editing dtp_form.dtp_document.InsertShapeByDrag(added_distorted_shape); end; //______________________________________________________________________________ procedure Tdtp_settings_form.freehand_tracking_editExit(Sender: TObject); // freehand proximity threshold in PAGE mm. var box_value:extended; begin if sb_check_valid_float(freehand_tracking_edit,0.1,100,box_value)=False then EXIT; // input limits 0.1 - 100 freehand_tracking:=box_value; end; //______________________________________________________________________________ procedure do_polygon(square:boolean); var added_polygon:TdtpFreehandShape; begin freehand_mode:=2; // polygon corners polygon_started:=False; square_polygon:=square; added_polygon:=TdtpFreehandShape.Create; SetPolygonShapeDefaults(added_polygon); added_polygon.UseFill:=True; // NOT square; added_polygon.UseOutline:=True; if polygon_line_width=0 // use default then added_polygon.OutlineWidth:=1.0/dtp_form.dtp_document.ScreenDpm // 1 pixel wide at screen res (arbitrary after trial and error) else begin added_polygon.OutlineWidth:=polygon_line_width; added_polygon.OutlineColor:=clGray; // paler for thick lines end; if square=True then added_polygon.FillColor:=$006688AA else added_polygon.FillColor:=$00E0E070; added_polygon.ClearPolygon; added_polygon.Add(0,0); // first point always 0,0 with dtp_form.dtp_document do begin added_polygon.Recording:=True; InsertShapeByClick(added_polygon); end;//with end; //______________________________________________________________________________ procedure Tdtp_settings_form.free_polygon_bitbuttonClick(Sender: TObject); begin do_polygon(False); // free polygon end; //______________________________________________________________________________ procedure Tdtp_settings_form.square_polygon_bitbuttonClick(Sender: TObject); begin do_polygon(True); // square polygon end; //______________________________________________________________________________ procedure Tdtp_settings_form.FormMouseWheelDown(Sender:TObject; Shift:TShiftState; MousePos:TPoint; var Handled:Boolean); begin Handled:=True; if panning_form.scroll_option_button.Checked=True then dtp_form.zoom_out_menu_entry.Click else dtp_form.zoom_in_menu_entry.Click; update_model_rulers; end; //______________________________________________________________________________ procedure Tdtp_settings_form.FormMouseWheelUp(Sender:TObject; Shift:TShiftState; MousePos:TPoint; var Handled:Boolean); begin Handled:=True; if panning_form.scroll_option_button.Checked=True then dtp_form.zoom_in_menu_entry.Click else dtp_form.zoom_out_menu_entry.Click; update_model_rulers; end; //______________________________________________________________________________ procedure Tdtp_settings_form.update_now_buttonClick(Sender: TObject); begin dtp_settings_form.allow_track_select_checkbox.Checked:=False; // don't allow it to be selected add_sb_track_plan_metafile(False,True); end; //______________________________________________________________________________ procedure Tdtp_settings_form.polygon_line_width_editExit(Sender: TObject); var box_value:extended; begin if sb_check_valid_float(polygon_line_width_edit,0,1000,box_value)=False then EXIT; // input limits 0 - 1000 polygon_line_width:=box_value_sb_wide(box_value); end; //______________________________________________________________________________ procedure Tdtp_settings_form.freehand_line_width_editExit(Sender: TObject); var box_value:extended; begin if sb_check_valid_float(freehand_line_width_edit,0,1000,box_value)=False then EXIT; // input limits 0 - 1000 freehand_line_width:=box_value_sb_wide(box_value); end; //______________________________________________________________________________ procedure Tdtp_settings_form.draw_export_rectangle_buttonClick(Sender: TObject); begin trackplan_boundary_rectangle_radiobutton.Checked:=True; dtp_form.Hide; pad_form.draw_boundary_rectangle_menu_entry.Click; end; //______________________________________________________________________________ procedure Tdtp_settings_form.rectangle_clear_buttonClick(Sender: TObject); begin if trackplan_boundary_rectangle_radiobutton.Checked=True then trackplan_fit_all_radiobutton.Checked:=True; // no rectangle to use. pad_form.clear_boundary_rectangle_menu_entry.Click; end; //______________________________________________________________________________ procedure Tdtp_settings_form.rectangle_set_buttonClick(Sender: TObject); begin trackplan_boundary_rectangle_radiobutton.Checked:=True; set_boundary_rectangle_dims(dtp_settings_form); end; //______________________________________________________________________________ procedure Tdtp_settings_form.formatted_text_bitbuttonClick(Sender: TObject); begin add_sb_formatted_txt_metafile; end; //______________________________________________________________________________ procedure Tdtp_settings_form.add_custom_buttonClick(Sender: TObject); // add a custom combined shape, if one exists const no_custom_str:string=' `0No custom combined item exists`x' +'||A custom item cannot be added because you have not yet created one.' +'||green_panel_begin' +'tree.gif To create a custom item, select a combined item on the sketchboard and then click the `0edit > set as custom item`1 menu item.' +'||Only one combined item can be set as a custom item at any one time.' +'||tree.gif To create a combined item, select multiple items on the sketchboard and then click the `0edit > combine items`1 menu item.' +'||tree.gif To select multiple items, drag a rectangle around them, or hold down the `0SHIFT`2 key and click on each one.' +'green_panel_end'; var added_custom_shape:TdtpGroupShape; begin if NOT assigned(custom_combined_shape) then begin help(0,no_custom_str,''); EXIT; end; added_custom_shape:=TdtpGroupShape.Create; added_custom_shape.Assign(custom_combined_shape); dtp_form.dtp_document.InsertShapeByClick(added_custom_shape); end; //______________________________________________________________________________ procedure Tdtp_settings_form.freehand_tracking_whats_this_labelClick(Sender:TObject); const free_tracking_help_str:string=' `0Freehand Tracking`9' +'||This number controls the smoothness of lines and edges when adding freehand patches and freehand lines.' +'||Setting a lower number will make your mouse or pen more sensitive. This may cause lines and edges to be rough and jagged unless you have a very steady hand.' +'||Setting a higher number will make your mouse less sensitive. This will cause lines and edges to be smoother.' +'||Setting a very high number will cause lines and edges to become angular and blocky.' +'||green_panel_begintree.gif Experiment with this setting to get the best result with the mouse or pen which you are using.' +'||Sensible numbers are generally in the range 0.5 - 6.green_panel_end' +'|This setting is saved in your program preferences.'; begin help(0,free_tracking_help_str,''); end; //______________________________________________________________________________ procedure Tdtp_settings_form.page_size_comboKeyPress(Sender:TObject; var Key:Char); begin Key:='-'; // 205e DropDowns must be ordinary combo style (able to receive key presses in edit box) // otherwise cannot be Focused and OnIdle will attempt to update while in use. // Change any meaningless key presses to a dash. // All dropdowns come here on KeyPress. end; //______________________________________________________________________________ procedure Tdtp_settings_form.re_frame_buttonClick(Sender: TObject); begin outline_edit_button.Click; edit_outline_form.edit_finish_button.Click; end; //______________________________________________________________________________ procedure Tdtp_settings_form.outline_edit_buttonClick(Sender:TObject); // 212a begin if edit_outline_form.Visible=True then begin ShowMessage('You must finish editing the previous item first.'); EXIT; end; if (TdtpShape(selected_shapes_list[0]) is Tdtp85aPolygonShape) then begin dtp_form.dtp_document.BeginUpdate; polygon_shape_now_editing:=Tdtp85aPolygonShape(selected_shapes_list[0]); with Tdtp85aPolygonShape(selected_shapes_list[0]) do begin undo_DocAngle:=DocAngle; undo_DocLeft:=DocLeft; undo_DocTop:=DocTop; undo_DocWidth:=DocWidth; undo_DocHeight:=DocHeight; undo_Flipped:=Flipped; undo_Mirrored:=Mirrored; undo_StorePoints:=StorePoints; save_pts_for_undo; undo_available:=True; if Flipped=True then begin Flipped:=False; normalize_flip; end; if Mirrored=True then begin Mirrored:=False; normalize_mirror; end; if DocAngle<>0 then begin normalize_rotation; DocRotate(0); end; now_edited:=True; StorePoints:=True; // stop calling GeneratePoints. create_markers; end;//with if outline_edit_button.Focused then edit_outline_form.Show; // not for fit rotation button dtp_form.save_dtp_as_menu_entry.Enabled:=False; // not while markers showing dtp_form.dtp_document.EndUpdate; end; end; //______________________________________________________________________________ procedure Tdtp_settings_form.undo_edits_buttonClick(Sender: TObject); begin if edit_outline_form.Visible=True then begin ShowMessage('You must finish editing the previous item first.'); EXIT; end; if (TdtpShape(selected_shapes_list[0]) is Tdtp85aPolygonShape) then begin with Tdtp85aPolygonShape(selected_shapes_list[0]) do begin if undo_available=True then begin polygon_shape_now_editing:=nil; dtp_form.dtp_document.BeginUpdate; DocAngle:=undo_DocAngle; DocLeft:=undo_DocLeft; DocTop:=undo_DocTop; DocWidth:=undo_DocWidth; DocHeight:=undo_DocHeight; Flipped:=undo_Flipped; Mirrored:=undo_Mirrored; restore_pts_from_undo; undo_available:=False; StorePoints:=undo_StorePoints; // non-freehand reverts to generating points. if StorePoints=False then now_edited:=False; Selected:=False; // causes update Selected:=True; // for more editing dtp_form.dtp_document.EndUpdate; end; end;//with end; end; //______________________________________________________________________________ procedure Tdtp_settings_form.marker_shape_changed(Sender:TObject); // 212a var n:integer; begin if outline_markers_list.Count<1 then EXIT; if sb_marker_size_is_changing=True then EXIT; // don't need to do anything for this change for n:=0 to outline_markers_list.Count-1 do begin if Sender=Tmarker(outline_markers_list.Objects[n]).marker_shape // find the marker then begin with Tmarker(outline_markers_list.Objects[n]) do begin // set new marker position marker_centre.x:=marker_shape.DocLeft-polygon_shape_now_editing.DocLeft+marker_shape.DocWidth/2; marker_centre.y:=marker_shape.DocTop-polygon_shape_now_editing.DocTop+marker_shape.DocHeight/2; end;//with BREAK; end; end;//next end; //______________________________________________________________________________ procedure sb_modify_markers_size; // 212a change size of markers // called from onIdle if size trackbar changed var n:integer; new_marker_size:single; begin if outline_markers_list.Count<1 then EXIT; new_marker_size:=edit_outline_form.marker_size_trackbar.Position/25; // default Position 75/25 = 3mm (page size) sb_marker_size_is_changing:=True; // we don't want OnChange for marker dtp_form.dtp_document.BeginUpdate; for n:=0 to outline_markers_list.Count-1 do begin with Tmarker(outline_markers_list.Objects[n]) do begin marker_shape.DocLeft:=polygon_shape_now_editing.DocLeft+marker_centre.x-new_marker_size/2; marker_shape.DocTop:=polygon_shape_now_editing.DocTop+marker_centre.y-new_marker_size/2; marker_shape.DocWidth:=new_marker_size; marker_shape.DocHeight:=new_marker_size; marker_shape.OutlineWidth:=new_marker_size/16; // 16 arbitrary end;//with end;//next dtp_form.dtp_document.EndUpdate; sb_marker_size_is_changing:=False; // reset end; //______________________________________________________________________________ procedure insert_new_marker; // insert new marker between selected marker and next one, or between last one and first one. var i,n,m:integer; oldx1,oldy1,oldx2,oldy2,newx,newy:Single; added_marker_size:single; added_marker:TdtpOutlineMarkerShape; marker_point:TFloatPoint; //////////////////////////////////////////////////////// function find_first_marker_with_same_line_index(index:integer):integer; var j:integer; begin RESULT:=0; // init for j:=0 to outline_markers_list.Count-1 do begin if Tmarker(outline_markers_list.Objects[j]).line_index=index then begin RESULT:=j; BREAK; end; end;//next end; //////////////////////////////////////////////////////// begin if outline_markers_list.Count<2 then EXIT; dtp_form.dtp_document.BeginUpdate; for n:=0 to outline_markers_list.Count-1 do begin with Tmarker(outline_markers_list.Objects[n]) do begin if marker_shape.Selected=True // find the marker then begin marker_shape.Selected:=False; oldx1:=marker_centre.x; oldy1:=marker_centre.y; if (nline_index // next one is new line then m:=find_first_marker_with_same_line_index(line_index); // to start of this line instead oldx2:=Tmarker(outline_markers_list.Objects[m]).marker_centre.x; oldy2:=Tmarker(outline_markers_list.Objects[m]).marker_centre.y; newx:=(oldx1+oldx2)/2; newy:=(oldy1+oldy2)/2; marker_point.x:=newx; marker_point.y:=newy; added_marker_size:=edit_outline_form.marker_size_trackbar.Position/25; // default Position 75/25 = 3mm (page size) added_marker:=TdtpOutlineMarkerShape.Create; SetPolygonShapeDefaults(added_marker); added_marker.DocLeft:=polygon_shape_now_editing.DocLeft+newx-added_marker_size/2; added_marker.DocTop:=polygon_shape_now_editing.DocTop+newy-added_marker_size/2; added_marker.DocWidth:=added_marker_size; added_marker.DocHeight:=added_marker_size; added_marker.PreserveAspect:=True; added_marker.UseOutline:=True; added_marker.UseFill:=False; added_marker.OutlineColor:=$00FF0080; // violet added_marker.OutlineWidth:=added_marker_size/16; // 16 arbitrary added_marker.FillColor:=$00FF0080; // violet added_marker.AllowResize:=False; added_marker.AllowRotate:=False; added_marker.OnChange:=dtp_settings_form.marker_shape_changed; // for when moved i:=n+1; if n=outline_markers_list.Count-1 // end of list then outline_markers_list.AddObject(IntToStr(i),Tmarker.Create) // add instead of insert else outline_markers_list.InsertObject(i,IntToStr(i),Tmarker.Create); // insert before i (after n) Tmarker(outline_markers_list.Objects[i]).line_index:=line_index; // same line as selected marker Tmarker(outline_markers_list.Objects[i]).marker_centre:=marker_point; Tmarker(outline_markers_list.Objects[i]).marker_shape:=added_marker; dtp_form.dtp_document.CurrentPage.ShapeAdd(added_marker); BREAK; end; end;//with end;//next dtp_form.dtp_document.EndUpdate; end; //______________________________________________________________________________ procedure start_new_marker_row; // start a new line var i,n:integer; n1,n2:integer; added_marker_size:single; added_marker1,added_marker2:TdtpOutlineMarkerShape; marker_point:TFloatPoint; new_line_index:integer; selection_count:integer; begin if outline_markers_list.Count<1 then EXIT; dtp_form.dtp_document.BeginUpdate; try selection_count:=num_markers_selected; // num selected will change added_marker_size:=edit_outline_form.marker_size_trackbar.Position/25; // default Position 75/25 = 3mm (page size) new_line_index:=Tmarker(outline_markers_list.Objects[outline_markers_list.Count-1]).line_index+1; // start a new line case selection_count of 0: begin // no markers selected, new line top-left of shape to bottom right... // top-left... marker_point.x:=0; marker_point.y:=0; added_marker1:=TdtpOutlineMarkerShape.Create; SetPolygonShapeDefaults(added_marker1); added_marker1.DocLeft:=polygon_shape_now_editing.DocLeft-added_marker_size/2; added_marker1.DocTop:=polygon_shape_now_editing.DocTop-added_marker_size/2; added_marker1.DocWidth:=added_marker_size; added_marker1.DocHeight:=added_marker_size; added_marker1.PreserveAspect:=True; added_marker1.UseOutline:=True; added_marker1.UseFill:=False; added_marker1.OutlineColor:=$00FF8000; // sea blue added_marker1.OutlineWidth:=added_marker_size/16; // 16 arbitrary added_marker1.FillColor:=$00FF8000; // sea blue added_marker1.AllowResize:=False; added_marker1.AllowRotate:=False; added_marker1.OnChange:=dtp_settings_form.marker_shape_changed; // for when moved i:=outline_markers_list.Count; i:=outline_markers_list.AddObject(IntToStr(i),Tmarker.Create); // add the marker Tmarker(outline_markers_list.Objects[i]).line_index:=new_line_index; Tmarker(outline_markers_list.Objects[i]).marker_centre:=marker_point; Tmarker(outline_markers_list.Objects[i]).marker_shape:=added_marker1; dtp_form.dtp_document.CurrentPage.ShapeAdd(added_marker1); // bottom right... marker_point.x:=polygon_shape_now_editing.DocWidth; marker_point.y:=polygon_shape_now_editing.DocHeight; added_marker2:=TdtpOutlineMarkerShape.Create; SetPolygonShapeDefaults(added_marker2); added_marker2.DocLeft:=polygon_shape_now_editing.DocLeft+polygon_shape_now_editing.DocWidth-added_marker_size/2; added_marker2.DocTop:=polygon_shape_now_editing.DocTop+polygon_shape_now_editing.DocHeight-added_marker_size/2; added_marker2.DocWidth:=added_marker_size; added_marker2.DocHeight:=added_marker_size; added_marker2.PreserveAspect:=True; added_marker2.UseOutline:=True; added_marker2.UseFill:=False; added_marker2.OutlineColor:=$00FF8000; // sea blue added_marker2.OutlineWidth:=added_marker_size/16; // 16 arbitrary added_marker2.FillColor:=$00FF8000; // sea blue added_marker2.AllowResize:=False; added_marker2.AllowRotate:=False; added_marker2.OnChange:=dtp_settings_form.marker_shape_changed; // for when moved i:=outline_markers_list.Count; i:=outline_markers_list.AddObject(IntToStr(i),Tmarker.Create); // add the marker Tmarker(outline_markers_list.Objects[i]).line_index:=new_line_index; Tmarker(outline_markers_list.Objects[i]).marker_centre:=marker_point; Tmarker(outline_markers_list.Objects[i]).marker_shape:=added_marker2; dtp_form.dtp_document.CurrentPage.ShapeAdd(added_marker2); end;//case no markers selected 1: begin // new line from selected marker to centre of shape... for n:=0 to outline_markers_list.Count-1 do begin with Tmarker(outline_markers_list.Objects[n]) do begin if marker_shape.Selected=True // find the marker then begin marker_shape.Selected:=False; // copy selected marker... added_marker1:=TdtpOutlineMarkerShape.Create; SetPolygonShapeDefaults(added_marker1); added_marker1.DocLeft:=marker_shape.DocLeft; added_marker1.DocTop:=marker_shape.DocTop; added_marker1.DocWidth:=added_marker_size; added_marker1.DocHeight:=added_marker_size; added_marker1.PreserveAspect:=True; added_marker1.UseOutline:=True; added_marker1.UseFill:=False; added_marker1.OutlineColor:=$00FF8000; // sea blue added_marker1.OutlineWidth:=added_marker_size/16; // 16 arbitrary added_marker1.FillColor:=$00FF8000; // sea blue added_marker1.AllowResize:=False; added_marker1.AllowRotate:=False; added_marker1.OnChange:=dtp_settings_form.marker_shape_changed; // for when moved i:=outline_markers_list.Count; i:=outline_markers_list.AddObject(IntToStr(i),Tmarker.Create); // add the marker Tmarker(outline_markers_list.Objects[i]).line_index:=new_line_index; Tmarker(outline_markers_list.Objects[i]).marker_centre:=marker_centre; Tmarker(outline_markers_list.Objects[i]).marker_shape:=added_marker1; dtp_form.dtp_document.CurrentPage.ShapeAdd(added_marker1); // now create new marker at shape centre... marker_point.x:=polygon_shape_now_editing.DocWidth/2; // centre of shape marker_point.y:=polygon_shape_now_editing.DocHeight/2; added_marker2:=TdtpOutlineMarkerShape.Create; SetPolygonShapeDefaults(added_marker2); added_marker2.DocLeft:=polygon_shape_now_editing.DocLeft+marker_point.x-added_marker_size/2; added_marker2.DocTop:=polygon_shape_now_editing.DocTop+marker_point.y-added_marker_size/2; added_marker2.DocWidth:=added_marker_size; added_marker2.DocHeight:=added_marker_size; added_marker2.PreserveAspect:=True; added_marker2.UseOutline:=True; added_marker2.UseFill:=False; added_marker2.OutlineColor:=$00FF8000; // sea blue added_marker2.OutlineWidth:=added_marker_size/16; // 16 arbitrary added_marker2.FillColor:=$00FF8000; // sea blue added_marker2.AllowResize:=False; added_marker2.AllowRotate:=False; added_marker2.OnChange:=dtp_settings_form.marker_shape_changed; // for when moved i:=outline_markers_list.Count; i:=outline_markers_list.AddObject(IntToStr(i),Tmarker.Create); // add the marker Tmarker(outline_markers_list.Objects[i]).line_index:=new_line_index; Tmarker(outline_markers_list.Objects[i]).marker_centre:=marker_point; Tmarker(outline_markers_list.Objects[i]).marker_shape:=added_marker2; dtp_form.dtp_document.CurrentPage.ShapeAdd(added_marker2); BREAK; end; end;//with end;//next end;//case 1 marker selected 2: begin // new line between selected markers... n1:=-1; // init n2:=-1; for n:=0 to outline_markers_list.Count-1 do begin with Tmarker(outline_markers_list.Objects[n]) do begin if marker_shape.Selected=True // find the first marker then begin n1:=n; marker_shape.Selected:=False; BREAK; end; end;//with end;//next for n:=0 to outline_markers_list.Count-1 do begin with Tmarker(outline_markers_list.Objects[n]) do begin if marker_shape.Selected=True // find the second marker then begin n2:=n; marker_shape.Selected:=False; BREAK; end; end;//with end;//next if (n1=-1) or (n2=-1) or (n1=n2) then EXIT; with Tmarker(outline_markers_list.Objects[n1]) do begin // copy first marker... added_marker1:=TdtpOutlineMarkerShape.Create; SetPolygonShapeDefaults(added_marker1); added_marker1.DocLeft:=marker_shape.DocLeft; added_marker1.DocTop:=marker_shape.DocTop; added_marker1.DocWidth:=added_marker_size; added_marker1.DocHeight:=added_marker_size; added_marker1.PreserveAspect:=True; added_marker1.UseOutline:=True; added_marker1.UseFill:=False; added_marker1.OutlineColor:=$00FF8000; // sea blue added_marker1.OutlineWidth:=added_marker_size/16; // 16 arbitrary added_marker1.FillColor:=$00FF8000; // sea blue added_marker1.AllowResize:=False; added_marker1.AllowRotate:=False; added_marker1.OnChange:=dtp_settings_form.marker_shape_changed; // for when moved i:=outline_markers_list.Count; i:=outline_markers_list.AddObject(IntToStr(i),Tmarker.Create); // add the marker Tmarker(outline_markers_list.Objects[i]).line_index:=new_line_index; Tmarker(outline_markers_list.Objects[i]).marker_centre:=marker_centre; Tmarker(outline_markers_list.Objects[i]).marker_shape:=added_marker1; dtp_form.dtp_document.CurrentPage.ShapeAdd(added_marker1); end;// with with Tmarker(outline_markers_list.Objects[n2]) do begin // copy second marker... added_marker2:=TdtpOutlineMarkerShape.Create; SetPolygonShapeDefaults(added_marker2); added_marker2.DocLeft:=marker_shape.DocLeft; added_marker2.DocTop:=marker_shape.DocTop; added_marker2.DocWidth:=added_marker_size; added_marker2.DocHeight:=added_marker_size; added_marker2.PreserveAspect:=True; added_marker2.UseOutline:=True; added_marker2.UseFill:=False; added_marker2.OutlineColor:=$00FF8000; // sea blue added_marker2.OutlineWidth:=added_marker_size/16; // 16 arbitrary added_marker2.FillColor:=$00FF8000; // sea blue added_marker2.AllowResize:=False; added_marker2.AllowRotate:=False; added_marker2.OnChange:=dtp_settings_form.marker_shape_changed; // for when moved i:=outline_markers_list.Count; i:=outline_markers_list.AddObject(IntToStr(i),Tmarker.Create); // add the marker Tmarker(outline_markers_list.Objects[i]).line_index:=new_line_index; Tmarker(outline_markers_list.Objects[i]).marker_centre:=marker_centre; Tmarker(outline_markers_list.Objects[i]).marker_shape:=added_marker2; dtp_form.dtp_document.CurrentPage.ShapeAdd(added_marker2); end;// with end;//case 2 markers selected end;//case finally dtp_form.dtp_document.EndUpdate; end;//try end; //______________________________________________________________________________ procedure Tdtp_settings_form.more_bitbuttonClick(Sender: TObject); begin add_item_page_control.ActivePage:=freehand_tab_sheet; end; //______________________________________________________________________________ procedure Tdtp_settings_form.outline_help_buttonClick(Sender: TObject); const sb_outline_help_str:string='php/590 `0Re-framing and editing outlines`9' +'||Use these controls to edit the outline of geometric and freehand items on the sketchboard.' +'||If the selected item has been rotated you can click the|`0re-frame`1 button to recalculate the outline as an unrotated item.' +' This doesn''t change the visible alignment. But it will display the item with a sharp outline instead of the slight fuzziness which rotation causes.' +'||To edit the outline of the selected item, click the `0edit outline...`1 button. The dialog for the outline markers will appear. Click the bar below for more information.' +'||To undo the most recent changes to the outline, click the `0undo edits`1 button.'; begin if help(0,sb_outline_help_str,'more information about outline markers')=1 then edit_outline_form.help_button.Click; end; //______________________________________________________________________________ procedure Tdtp_settings_form.open_mystuff_buttonClick(Sender: TObject); begin open_MyPictures; // in control room end; //______________________________________________________________________________ procedure Tdtp_settings_form.jpg_quality_buttonClick(Sender: TObject); begin control_room_form.jpg_menu_entry.Click; end; //______________________________________________________________________________ procedure Tdtp_settings_form.FormShow(Sender: TObject); var geometric_html_str:string; freehand_html_str:string; polygon_html_str:string; both_html_str:string; formatted_text_html_str:string; plain_text_html_str:string; fancy_text_html_str:string; image_file_html_str:string; pasted_image_html_str:string; metafile_html_str:string; add_custom_html_str:string; font_size:integer; font_str:string; begin font_size:=13; font_str:=arial_str; formatted_text_html_str:='' +'

click the button on the left to add a block of formatted text to the sketchboard.

' +'

the text editor window will open.

' +'

text can be entered directly in the editor, or copied and pasted from Microsoft Word, or loaded from an RTF file saved from Word.

' +'

the block of formatted text can be moved, resized, rotated, and also stretched (for which untick the lock aspect ratio tickbox).

' +''; plain_text_html_str:='' +'

click the buttons on the right to add plain text.

' +'

drag an outline on the sketchboard to contain it.

' +'

the modify tab will open to edit the text.

' +''; fancy_text_html_str:='' +'

click the buttons on the left to add fancy text.

' +'

drag an outline on the sketchboard to contain it.

' +'

the modify tab will open to edit the text.

' +''; geometric_html_str:='' +'

click one of the buttons below, then drag an outline on the sketchboard.

' +'

it can then be modified - moved, rotated, resized, stretched, colours changed, outline edited - click the modify tab above.

' +''; both_html_str:='' +'

click one of the buttons below to begin drawing.

' +'

press the ENTER key to finish drawing, ' +'or press the SPACE bar to join the end point back to the start, and then finish drawing.

' +'

press the ESC key to cancel the drawing.

' +'

set 0 (zero) line width to reset the default thin black lines.

' +''; freehand_html_str:='' +'drawing freehand patches and lines:' +'

drag an outline with the mouse held down.

' +'

release the mouse and repeat for another patch or another line.

' +'

press or hold down the DELETE key to undo.

' +'

press the L key to link from an existing patch or line and continue.

' +'

hold down the CTRL key while drawing to create a straight section.

' +''; polygon_html_str:='' +'drawing polygons and polylines:' +'

click corner positions to create an outline.

' +'

press the DELETE key to undo corners.

' +'

press the E or F keys to set empty polyline or filled polygon.

' +'

press the X and Y keys to link back to the starting point.

' +'

hold down the CTRL key to allow angled sides on a square polygon.

' +''; image_file_html_str:='' +'

click the button on the left to add an image file to the sketchboard.

' +'

if the file name includes scaling data it will be scaled automatically to match your trackplan.
then drag it from the centre of the sketchboard to the required position.

' +'

otherwise drag an outline on the sketchboard to contain it.

' +''; pasted_image_html_str:='' +'

click the buttons on the left to paste a copied image onto the sketchboard, or scan an image from your scanner.

' +'

drag an outline to contain it.

' +''; metafile_html_str:='' +'

click the button on the left to add a metafile image to the sketchboard.

' +'

drag an outline to contain it.

' +'

metafile images zoom without becoming fuzzy and are good for graphics, CAD drawings, icons, logos and clip-art.

' +''; add_custom_html_str:='' +'

click the button above to add a previously created custom item to the sketchboard.

' +'

then click on the sketchboard at the required location.

' +'

' +'

to create a custom item, select a combined item on the sketchboard and then click the edit > set as custom item menu item.' +' Only one combined item can be set as a custom item at any one time.

' +'

to create a combined item, select multiple items on the sketchboard and then click the edit > combine items menu item.

' +'

to select multiple items, drag a rectangle around them, or hold down the SHIFT key and click on each one.

' +''; both_html_view.LoadFromString(both_html_str); freehand_html_view.LoadFromString(freehand_html_str); polygon_html_view.LoadFromString(polygon_html_str); geometric_html_view.LoadFromString(geometric_html_str); formatted_text_html_view.LoadFromString(formatted_text_html_str); plain_text_html_view.LoadFromString(plain_text_html_str); fancy_text_html_view.LoadFromString(fancy_text_html_str); image_file_html_view.LoadFromString(image_file_html_str); pasted_image_html_view.LoadFromString(pasted_image_html_str); metafile_html_view.LoadFromString(metafile_html_str); add_custom_html_view.LoadFromString(add_custom_html_str); end; //______________________________________________________________________________ procedure Tdtp_settings_form.mimic_info_buttonClick(Sender: TObject); // 226e const str:string='php/570 `0design aid for control panels`9' +'||1. create an `0export boundary rectangle`3 enclosing the track area on the trackpad which you want to use for a mimic control panel or signal box diagram.' +'||2. set the sketchboard page size on the `0page`1 tab on the sketchboard control panel.' +'||3. then click `0continue`1 button below.| '; begin if help(0,str,'cancel')=1 then EXIT else mimic_button.Click; end; //______________________________________________________________________________ procedure Tdtp_settings_form.mimic_buttonClick(Sender: TObject); // 226e var rect_wide,rect_high:extended; page_wide,page_high:extended; y_percent,factor:extended; n,i,bgnd_count:integer; str:string; begin rect_wide:=0; // init.. rect_high:=0; page_wide:=0; page_high:=0; if draw_export_rectangle_flag=False then begin show_modal_message('error: An export boundary rectangle has not been defined.' +#13+#13+'Unable to proceed.'); EXIT; end; rect_wide:=ABS(output_rectangle_x1-output_rectangle_x2); rect_high:=ABS(output_rectangle_y1-output_rectangle_y2); page_wide:=dtp_form.dtp_document.CurrentPage.PageWidth; page_high:=dtp_form.dtp_document.CurrentPage.PageHeight; if (rect_wide<10) or (rect_high<10) or (page_wide<10) or (page_high<10) // div 0 protection then begin show_modal_message('error: Invalid data. All sizes must be greater than 10 mm.' +#13+#13+'Unable to proceed.'); EXIT; end; factor:=rect_wide/page_wide; y_percent:=rect_wide*page_high*100/page_wide/rect_high; str:='trackpad rectangle :' +'|| width = '+round_str(rect_wide,2)+' mm height = '+round_str(rect_high,2)+' mm' +'||sketchboard page:' +'|| width = '+round_str(page_wide,2)+' mm height = '+round_str(page_high,2)+' mm' +'|
' +'|Set the Y-scaling data-distortion to : '+round_str(y_percent,2)+' %' +'|||The factor for line thicknesses is : '+round_str(factor,2)+'' +'|||Make a note of these settings.|Do you want the Y-scaling copied to the clipboard ?' +'||Or do you want Templot to make all the adjustments ready for image export ?'; i:=alert(2,'php/570 mimic panel settings', str, '','','no thanks','yes - copy Y-scaling','','yes please - make ready for image export',0); case i of 4: Clipboard.AsText:=round_str(y_percent,2); 6: begin output_rectangle_y1:=output_rectangle_y1*y_percent/100; output_rectangle_y2:=output_rectangle_y2*y_percent/100; bgnd_count:=any_bgnd; if bgnd_count>0 then keep_form.wipe_all_menu_entry.Click; y_distortion_factor:=y_percent/100; control_room_form.y_scaling_menu_entry.Checked:=(y_distortion_factor<>1); if bgnd_count>0 then keep_form.all_to_bgnd_menu_entry.Click; end; end;//case redraw(True); end; //______________________________________________________________________________ function find_reference_item:integer; // 227a var i:integer; dtp_shape_tag:Tdtp_shape_tag; begin RESULT:=-1; // init for i:=0 to dtp_form.dtp_document.CurrentPage.ShapeCount-1 do begin // first clear any existing reference item dtp_shape_tag:=Tdtp_shape_tag(dtp_form.dtp_document.CurrentPage.Shapes[i].Tag); if dtp_shape_tag.reference=True then begin RESULT:=i; EXIT; end; end;//next end;//__________________________________________________________________________ end.