Author Topic: extended data routine :: beta testers wanted  (Read 8137 times)

0 Members and 1 Guest are viewing this topic.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
extended data routine :: beta testers wanted
« Reply #15 on: May 06, 2004, 02:57:16 PM »
TheSwamp.org  (serving the CAD community since 2003)

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
extended data routine :: beta testers wanted
« Reply #16 on: May 07, 2004, 08:12:23 AM »
New version (0.5)
reads from predefined notes, see included help file.

Program:
http://www.theswamp.org/swamp.files/Public/xNotes-0.5.zip

source files:
http://www.theswamp.org/swamp.files/Public/xNotes-src.zip
TheSwamp.org  (serving the CAD community since 2003)

Water Bear

  • Guest
extended data routine :: beta testers wanted
« Reply #17 on: May 10, 2004, 06:47:59 AM »
Mark..I see that you've been doing some detailed work on xdata. Is it possible to add xdata to a group, so that it shows up no matter which component is selected?

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
extended data routine :: beta testers wanted
« Reply #18 on: May 10, 2004, 07:46:33 AM »
It can be done, but not with what I've done so far.
TheSwamp.org  (serving the CAD community since 2003)

SMadsen

  • Guest
extended data routine :: beta testers wanted
« Reply #19 on: May 10, 2004, 08:34:18 AM »
Man, you make it hard to test your stuff with that one file per function idea! Is it that VIM again?  :twisted:

Mark, I have a few comments. Got a few deadly crashes with your program but I didn't have time to see where they came from. Once I added a FINDFILE in READ-USER-XNOTES it didn't happen again.
Also, in the dialog function, wouldn't you rather have the chosen list item appear in the edit box? Of course, it should have a reset option if a note exists already.
Below are some small suggestions to the dialog code, such as offering edit of a chosen note and moving the OK processing outside of the dialog (it came up with empty $value)

Code: [Select]
(defun read-user-xnotes (/ xenv fo lst)
  (if (setq xenv (getenv "user-xnotes"))
    (if (not (findfile xenv))
      (progn
        (setenv "user-xnotes" "")
        (alert
          "user notes files missing \n will now reset environment"
        )
        (setq xenv (set-user-xnotes-env))
      )
    )
    (setq xenv (set-user-xnotes-env))
  )

  (if xenv
    (progn
      ;; {* changed
      ;;    only go ahead and open if xenv is actually found
      (cond ((setq xenv (findfile xenv))
             (setq fo (open xenv "r"))
             (while (setq each-line (read-line fo))
               (setq lst (cons each-line lst))
             )
             (close fo)
            )
      )
      ;; changed *}
    )
  )
  ;; btw, if statement is redundant :)
  (if lst (reverse lst))
)

Code: [Select]
(defun xnotes-dialog
       (msg note_type / dcl_id note action addval getNote)
  (defun getNote (val lst)
    (set_tile "addnote" (nth (atoi $value) lst))
  )

  (setq dcl_id (load_dialog "xnotes.dcl"))
  (if (not (new_dialog "xdialog" dcl_id))
    (exit)
  )

  (start_list "xnotelst")
  (setq tmplst (read-user-xnotes))
  (mapcar 'add_list tmplst)
  (end_list)

  (set_tile "note_t" note_type)

  (set_tile "addnote" msg)
  (mode_tile "addnote" 3)

  ;;{* added
  (action_tile "xnotelst" "(setq addval (getNote $value tmplst))")
  (action_tile "addnote" "(setq addval $value)")
  ;; a reset tile would be good (just gray it out if note doesn't exist)
  ;; added *}

  ;; {* removed
;;;  (action_tile
;;;    "accept"
;;;    "(progn
;;;      (setq val1 (get_tile \"xnotelst\"))
;;;      (setq val2 (get_tile \"addnote\"))
;;;      (done_dialog)
;;;    )"
;;;  )
;;;  (action_tile
;;;    "cancel"
;;;    "(progn (done_dialog) (exit))"
;;;  )
  ;; removed *}
  ;; {* changed
  (setq action (start_dialog))
  ;; changed *}
  ;; {* added
  (cond ((= action 1)
         (setq note addval)
        )
        ((setq note ""))
  )
  ;; added *}
  (unload_dialog dcl_id)
  ;; {* removed
;;;  (if (or val1 val2)
;;;    (if (= val1 "")
;;;      (setq note val2)
;;;                                        ; else
;;;      (setq note (nth (atoi val1) tmplst))
;;;    )
;;;  )
  ;; removed *}
  note
)