home *** CD-ROM | disk | FTP | other *** search
- ;dBRIEF Graphics - v3.10
- ;Copyright (c) 1991 - Global Technologies Corporation
- ;ALL RIGHTS RESERVED
- #include "dbrief.h"
- (macro draw
- (
- (string draw_temp_str
- )
- (if (get_parm 0 draw_temp_str)
- (switch (upper (substr draw_temp_str 1 1))
- "F"
- (_frame)
- "C"
- (_cursor)
- "L"
- (_line)
- "B"
- (_box)
- "A"
- (_area)
- )
- ;else
- (
- (= temp_str "NULL")
- (_pick_menu (search_path (inq_environment dbr_mnu_path) "graphics.mnu") "Graphics" 38 09 65 02)
- (if (!= temp_str "NULL")
- (execute_macro temp_str)
- )
- )
- )
- )
- )
- (macro _frame
- (
- (int width
- height
- beg_line
- beg_col
- end_line
- end_col
- top_line
- current_line
- current_column
- )
- (string temp_str1
- temp_str2
- )
- (if (== (inq_marked) 2)
- (
- (drop_bookmark 5 "y")
- (top_of_window)
- (inq_position top_line NULL)
- (goto_bookmark 5)
- (inq_marked beg_line beg_col end_line end_col)
- (-= beg_line top_line)
- (-= end_line top_line)
- (raise_anchor)
- (message "Generating frame, stand by...")
- (= width (- end_col (+ beg_col 1)))
- (= height (- end_line beg_line))
- (-= height 1)
- (top_of_buffer)
- (if (search_fwd "~frame~" 1 0)
- (
- (inq_position NULL current_column)
- (delete_to_eol)
- )
- ;else
- (move_abs beg_line 1)
- )
- (= temp_str1 (_frame_component 1 beg_line beg_col (substr ul_char dbr_graphics 1) NULL current_column))
- (= temp_str2 (_frame_component 2 NULL NULL (+ (_replicate (substr hr_char dbr_graphics 1) width) (substr ur_char dbr_graphics 1)) NULL current_column))
- (move_abs 0 current_column)
- (insert (+ temp_str1 temp_str2))
- (= temp_int 0)
- (while (<= (++ temp_int) height)
- (
- (+= beg_line 1)
- (if (== width 78)
- (= temp_str1 (_frame_component 3 beg_line beg_col (substr vr_char dbr_graphics 1) temp_int current_column))
- ;else
- (= temp_str1 (_frame_component 4 beg_line beg_col (substr vr_char dbr_graphics 1) temp_int current_column))
- )
- (= temp_str2 (_frame_component 5 NULL NULL (+ (_replicate " " width) (substr vr_char dbr_graphics 1)) temp_int current_column))
- (move_abs 0 current_column)
- (insert (+ temp_str1 temp_str2))
- )
- )
- (+= beg_line 1)
- (if (== width 78)
- (= temp_str1 (_frame_component 3 beg_line beg_col (substr ll_char dbr_graphics 1) NULL current_column))
- ;else
- (= temp_str1 (_frame_component 4 beg_line beg_col (substr ll_char dbr_graphics 1) NULL current_column))
- )
- (= temp_str2 (_frame_component 5 NULL NULL (+ (_replicate (substr hr_char dbr_graphics 1) width) (substr lr_char dbr_graphics 1)) NULL current_column))
- (move_abs 0 current_column)
- (insert (+ temp_str1 temp_str2))
- (move_abs 0 current_column)
- (_display_popup_message "Frame complete." "" 0)
- )
- ;else
- (_display_popup_message "No marked block!" "" 1)
- )
- )
- )
- (macro _control_key
- (
- (if (= dbr_curr_line (inq_mode))
- (insert_mode)
- ;else
- (= dbr_curr_line 0)
- )
- (assign_to_key "<ctrl-f1>" "_ul")
- (assign_to_key "<ctrl-f2>" "_ur")
- (assign_to_key "<ctrl-f3>" "_hr")
- (assign_to_key "<ctrl-f4>" "_vr")
- (assign_to_key "<ctrl-f5>" "_ll")
- (assign_to_key "<ctrl-f6>" "_lr")
- )
- )
- (macro _cursor
- (
- (int _overtype
- )
- (if (= dbr_curr_line (inq_mode))
- (insert_mode)
- ;else
- (= dbr_curr_line 0)
- )
- (assign_to_key "<left>" "_left_arrow")
- (assign_to_key "<up>" "_up_arrow")
- (assign_to_key "<down>" "_down_arrow")
- (assign_to_key "<right>" "_right_arrow")
- (= temp_int 0)
- (_display_graphics_mode dbr_graphics)
- )
- )
- (macro nodr
- (
- (if dbr_curr_line
- (insert_mode)
- )
- (assign_to_key "<ctrl-f1>" "nothing")
- (assign_to_key "<ctrl-f2>" "nothing")
- (assign_to_key "<ctrl-f3>" "nothing")
- (assign_to_key "<ctrl-f4>" "nothing")
- (assign_to_key "<ctrl-f5>" "search_case")
- (assign_to_key "<ctrl-f6>" "toggle_re")
- (assign_to_key "<left>" "left")
- (assign_to_key "<up>" "up")
- (assign_to_key "<down>" "down")
- (assign_to_key "<right>" "right")
- (_display_popup_message "Draw mode is off." "" 0)
- )
- )
- (macro _left_arrow
- (
- (string _characters
- )
- (if (!= (read 1) "\n")
- (delete_char)
- )
- (switch temp_int
- 1
- (= _characters ur_char)
- 3
- (= _characters lr_char)
- 0 NULL
- 2 NULL
- 4
- (= _characters hr_char)
- )
- (insert (substr _characters dbr_graphics 1))
- (move_rel 0 -2)
- (= temp_int 2)
- )
- )
- (macro _right_arrow
- (
- (string _characters
- )
- (if (&& (!= (read 1) "\n")(! (inq_mode)))
- (delete_char)
- )
- (switch temp_int
- 0 NULL
- 2 NULL
- 4
- (= _characters hr_char)
- 1
- (= _characters ul_char)
- 3
- (= _characters ll_char)
- )
- (insert (substr _characters dbr_graphics 1))
- (= temp_int 4)
- )
- )
- (macro _down_arrow
- (
- (string _characters
- )
- (if (&& (!= (read 1) "\n")(! (inq_mode)))
- (delete_char)
- )
- (switch temp_int
- 0 NULL
- 1 NULL
- 3
- (= _characters vr_char)
- 2
- (= _characters ul_char)
- 4
- (= _characters ur_char)
- )
- (insert (substr _characters dbr_graphics 1))
- (move_rel 1 -1)
- (= temp_int 3)
- )
- )
- (macro _up_arrow
- (
- (string _characters
- )
- (if (&& (!= (read 1) "\n")(! (inq_mode)))
- (delete_char)
- )
- (switch temp_int
- 0 NULL
- 1 NULL
- 3
- (= _characters vr_char)
- 2
- (= _characters ll_char)
- 4
- (= _characters lr_char)
- )
- (insert (substr _characters dbr_graphics 1))
- (move_rel -1 -1)
- (= temp_int 1)
- )
- )
- (macro _ul
- (
- (= temp_int 1)
- (_right_arrow)
- )
- )
- (macro _ur
- (
- (= temp_int 4)
- (_down_arrow)
- (move_rel -1 1)
- )
- )
- (macro _hr
- (
- (= temp_int 0)
- (_right_arrow)
- )
- )
- (macro _vr
- (
- (= temp_int 0)
- (_up_arrow)
- (move_rel 1 1)
- )
- )
- (macro _lr
- (
- (= temp_int 4)
- (_up_arrow)
- (move_rel 1 1)
- )
- )
- (macro _ll
- (
- (= temp_int 3)
- (_right_arrow)
- )
- )
- (macro _line
- (
- (extern _col_delete
- )
- (int beg_line
- beg_col
- end_line
- end_col
- length
- line_height
- mark_type
- )
- (string line
- vert_char
- prompt_string
- )
- (= mark_type (inq_marked beg_line beg_col end_line end_col))
- (if (|| (== end_line beg_line)(== mark_type 3))
- (= prompt_string "Horz. Chr's 1)≡ 2)≈ 3)▀ 4)▄ 5)─ 6)═ 7)* ")
- ;else
- (= prompt_string "Vert. Chr's 1)▌ 2)▐ 3)│ 4)║ 5)* ")
- )
- (if (== (get_parm 1 temp_str prompt_string 1) 1)
- (
- (= temp_int (atoi temp_str))
- (if (&& (> temp_int 0)(< temp_int 8))
- (
- (if (== (substr prompt_string 1 4) "Vert")
- (
- (+= temp_int 2)
- (= vert_char (substr "≡≈▌▐│║*" temp_int 1))
- (= line "")
- )
- ;else
- (= line (substr "≡≈▀▄─═*" temp_int 1))
- )
- (if (<= mark_type 3)
- (
- (message "Drawing image, stand by...")
- (if (== mark_type 3)
- (
- (= beg_col 1)
- (beginning_of_line)
- (delete_to_eol)
- (= beg_line end_line)
- (= end_col (- (inq_line_length) 1))
- )
- )
- (save_position)
- (raise_anchor)
- (if (strlen line)
- (
- (set_msg_level 3)
- (move_abs 0 beg_col)
- (drop_anchor 2)
- (move_abs 0 end_col)
- (_col_delete)
- (= length (+ (- end_col beg_col) 1))
- (move_abs beg_line beg_col)
- (= temp_int 0)
- (move_abs beg_line beg_col)
- (= line (_replicate line length))
- (insert line)
- (set_msg_level 0)
- )
- ;else
- (
- (= line_height (- end_line beg_line))
- (move_abs beg_line beg_col)
- (= temp_int 0)
- (while (<= temp_int line_height)
- (
- (if (!= (read 1) "\n")
- (delete_char)
- )
- (insert vert_char)
- (move_rel 1 -1)
- (++ temp_int)
- )
- )
- )
- )
- (restore_position)
- (message "")
- (_display_popup_message "Drawing complete..." "" 0)
- )
- ;else
- (_display_popup_message "Incorrect mark type!" "" 1)
- )
- )
- ;else
- (_display_popup_message "Invalid response!" "" 1)
- )
- )
- )
- )
- )
- (macro _box
- (
- (int beg_line
- beg_col
- end_line
- end_col
- length
- )
- (string line
- uprt_char
- uplt_char
- lrlt_char
- lrrt_char
- vert_char
- )
- (if (== (get_parm 1 temp_str "Box Chr's 1░ 2▒ 3▓ 4█ 5│ 6║ 7* 8<space> " 1) 1)
- (
- (= temp_int (atoi temp_str))
- (if (&& (< temp_int 9)(> temp_int 0))
- (
- (= line (substr "░▒▓█─═* " temp_int 1))
- (= uplt_char (substr "░▒▓█┌╔* " temp_int 1))
- (= uprt_char (substr "░▒▓█┐╗* " temp_int 1))
- (= lrlt_char (substr "░▒▓█└╚* " temp_int 1))
- (= lrrt_char (substr "░▒▓█┘╝* " temp_int 1))
- (= vert_char (substr "░▒▓█│║* " temp_int 1))
- (if (== 2 (inq_marked beg_line beg_col end_line end_col))
- (
- (message "Drawing image, stand by...")
- (save_position)
- (raise_anchor)
- (= length (- (- end_col beg_col) 1))
- (move_abs beg_line beg_col)
- (= line (_replicate line length))
- (insert uplt_char)
- (insert line)
- (insert uprt_char)
- (drop_anchor 2)
- (move_rel 0 (- end_col beg_col))
- (set_msg_level 3)
- (_col_delete)
- (down)
- (inq_position temp_int)
- (while (< temp_int end_line)
- (
- (move_abs 0 beg_col)
- (if (!= (read 1) "\n")
- (delete_char)
- )
- (insert vert_char)
- (move_abs 0 end_col)
- (if (!= (read 1) "\n")
- (delete_char)
- )
- (insert vert_char)
- (down)
- (inq_position temp_int)
- )
- )
- (move_abs 0 beg_col)
- (insert lrlt_char)
- (insert line)
- (insert lrrt_char)
- (drop_anchor 2)
- (move_rel 0 (- end_col beg_col))
- (_col_delete)
- (restore_position)
- (set_msg_level 0)
- (message "")
- (_display_popup_message "Drawing complete..." "" 0)
- )
- ;else
- (_display_popup_message "No block marked!" "" 1)
- )
- )
- ;else
- (_display_popup_message "Invalid response!" "" 1)
- )
- )
- )
- )
- )
- (macro _area
- (
- (int beg_line
- beg_col
- end_line
- end_col
- length
- kk
- )
- (string line
- )
- (if (== (get_parm 1 temp_str "Fill Chr's 1░ 2▒ 3▓ 4█ 5* 6<space> " 1) 1)
- (
- (= temp_int (atoi temp_str))
- (if (&& (< temp_int 7)(> temp_int 0))
- (
- (= line (substr "░▒▓█* " temp_int 1))
- (if (== 2 (inq_marked beg_line beg_col end_line end_col))
- (
- (message "Drawing image, stand by...")
- (set_msg_level 3)
- (save_position)
- (_col_delete)
- (= length (- end_col beg_col))
- (move_abs beg_line beg_col)
- (= line (_replicate line (+ length 1)))
- (= kk 1)
- (while (<= kk (+ (- end_line beg_line) 1))
- (
- (insert line)
- (move_abs 0 beg_col)
- (down)
- (++ kk)
- )
- )
- (_display_popup_message "Drawing complete..." "" 0)
- (set_msg_level 0)
- (message "")
- )
- ;else
- (_display_popup_message "Column mark required!" "" 1)
- )
- )
- ;else
- (_display_popup_message "Invalid response!" "" 1)
- )
- )
- )
- )
- )