Hi,

I'm trying to implement drag & drop on Mac, and it works ok as long as  
only one file is dropped into Scid. When multiple files are dropped  
Scid crashes. I think that the opening processes of each file overlap  
and make a mess, I tested my theory using "after $delay (open file  
here)" and incrementing delay for 15 seconds on each file, every file  
opens just fine as long as it takes less than 15 seconds to open  
(q.e.d.?).

So, what can I do to make every OpenDocument process to wait for the  
previous one to finish? any tips?

Israel

P.S.: Here is the code starting on line 31 of start.tcl (doesn't work  
if it's placed on the end), just in case:

if {![catch {tk windowingsystem} wsystem] && $wsystem == "aqua"} {

   # Drag & Drop

   # Give 4 seconds to let Scid start up or ::file::Open won't be ready.
   set delaydnd -11000
   set incrdel 15000

   proc dragndrop {file} {
     global delaydnd
     global incrdel

     #Scid doesn't handle well .sg3 and .sn3 files.
     if {([file extension $file] == ".sg3") || \
       ([file extension $file] == ".sn3")} {
       set dName [file dirname $file]
       set eName ".si3"
       set fName [file rootname $file]

       set file "$fName$eName"

     }

     # check if the base is already opened
     if {[sc_base slot $file] != 0} {
       tk_messageBox -type ok -icon info -title "Scid" -message "That  
database is already opened."
       return
     } else  {
       # Add 15s to delay to test idea.
       set delaydnd [expr $delaydnd + $incrdel]
       after $delaydnd [list ::file::Open $file]
       return

     }

   }
   proc tkOpenDocument {args} {
     foreach file $args {
       after idle [list dragndrop $file]
     }
   }
   # ::tk::mac::OpenDocument is called on MacOS to open files.
   rename tkOpenDocument ::tk::mac::OpenDocument

}

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Scid-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scid-users

Reply via email to