bugDenemo - Bugs: bug #28039, Delete Barline command

 
 

bug #28039: Delete Barline command

Submitter:  None
Submitted:  Tue 17 Nov 2009 06:16:59 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Originator Name:  Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 30 Nov 2009 04:40:25 PM UTC, comment #6: 

The current version of the command seems to be working fine - the command operates when you are on the barline, and it ends up on the, which is the same behaviour when you use DeleteObject and when you use DeletePreviousObject.
So I think this is ok.

Richard Shann <rshann>
Group administrator
Sun 29 Nov 2009 08:59:44 AM UTC, comment #5: 

I have just tried the new command, and when deleting a barline it leaves a Spot behind.
This is using the command as it is below. Seems strange as the final act is the DeleteObject.

Richard Shann <rshann>
Group administrator
Thu 26 Nov 2009 10:33:01 AM UTC, comment #4: 

Thank you for this.
It looks like you have created a command that could hide the fact that the Denemo measure boundaries are not objects (like notes etc). I guess we could call that SmartDelete and make that the default delete?
About the script:
 I recently created commands to push and pop the cursor position, which would avoid the need to insert and delete "Spot". (These are exploited in the new script for Paste, which I documented at http://denemo.org/index.php/Paste_Command_Script)

Another minor point is that creating-if-needed a standalone and doing CursorLeft has been wrapped in a convenience procedure (d-Directive-standalone "Spot")
(Well, the create and move left is (d-Directive-standalone-tag "Spot"), the other does nothing if there is already a standalone of that tag).

Thank you very much for your contributions.

Richard Shann <rshann>
Group administrator
Wed 25 Nov 2009 09:45:58 PM UTC, comment #3: 

A minor problem with this new script is that it leaves the cursor at the beginning of the new bar, rather than back where the cursor was when you deleted the barline.  I'm including a script that fixes this.  I wasn't all that familiar with the DirectivePut command so it might be sort of redundant the way I did it.  But it appears to work.  Also, this script deletes an object if you're not at the end of a bar.  If this is not desirable, then just move the final command, (d-DeleteObject), to just before the third-to-last parenthesis, so that it's inside the begin statement, and it will only delete a barline when it's on or right before one. -Dan W.

(let (( type (d-GetType) ))
(if  (or (equal? type  "Appending" ) (equal? type "None" ) ) ; if at the end of bar...
(begin
(d-DirectivePut-standalone-display "Spot" "Spot") ;mark our spot, to return later.
(d-CursorLeft)
(d-SetMark)  ;so we can copy and paste
(if (d-MeasureRight) ;; don't  delete next bar if there isn't one
(begin
(d-MeasureLeft) ;; Now we're at the beginning of that measure
(d-Cut)
(d-DeleteMeasure)
(d-Paste) )
(d-UnsetMark)  ;this is to clear the mark if we set it, but were at end of staff
); if (d-MeasureRight)
;;;Modified Next BookmarkR by Nils Gey-get back to our spot.
(let gotoSpot ()
(if  (and (not (d-DirectiveGet-standalone-display "Spot")) (d-CursorRight) )
(gotoSpot))
)
) ;begin
) ; if
) ;let
(d-DeleteObject) ;deletes "Spot" if we removed a barline, otherwise deletes next object.

Anonymous
Wed 18 Nov 2009 10:06:05 AM UTC, comment #2: 

Oh, I tried (d-DeleteObject) in place of (d-UnserMark) but it doesn't seem to delete objects (cursor on notes in middle of measure), it still deletes barlines though.

Richard Shann <rshann>
Group administrator
Wed 18 Nov 2009 10:00:30 AM UTC, comment #1: 

Thank you. This is now in git: I prefixed with (let
so that type did not pollute the global variables. The comments would slow things down, which would matter if it were being called in a loop from something else.
Latest scheme has byte encoding which we will move to when we start to get efficiency issues, so we should keep all the comments we can, they are so useful for writing new scripts.

Richard Shann <rshann>
Group administrator
Tue 17 Nov 2009 06:16:59 PM UTC, original submission:  

I noticed the Delete Barline command.  I wrote a script which I've been using for a while now, and it's pretty successful, whereas the existing one, I tried it and it seems to either do nothing or delete a measure.

(define type (d-GetType) ) ;don't try it if not at the end of bar
(if  (or (equal? type  "Appending" ) (equal? type "None" ) )
(begin (d-SetMark)
(if (d-MeasureRight) ;;we don't want to delete next bar if there isn't one!
  (begin (d-MeasureLeft) ;; Now we're at the beginning of that measure
(d-Cut)
(d-DeleteMeasure)
(d-Paste) )
  (d-UnsetMark)  ;this is to clear the mark if we set it, but were at end of staff
  )
)
)

This script can be used to define a "smarter" DeleteObject command, that deletes the barline if it's at the end of the bar.  Just change (d-UnsetMark) to (d-DeleteObject).  Comments are just there for your understanding; do they slow down the scripts?  If so I say ditch them.
-Dan W.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by steele (Updated the item)
  • -email is unavailable- added by rshann (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-12-04 steele Open/ClosedOpen Closed
    2009-11-30 rshann StatusIn Progress Fixed
    2009-11-29 rshann StatusFixed In Progress
    2009-11-18 rshann StatusNone Fixed

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code