+
+ // extract level or artwork set from zip file to target directory
+ char *top_dir = ExtractZipFileIntoDirectory(filename, directory, tree_type);
+
+ if (top_dir == NULL)
+ {
+ // error message already issued by "ExtractZipFileIntoDirectory()"
+
+ return TREE_TYPE_UNDEFINED;
+ }
+
+ // add extracted level or artwork set to tree info structure
+ AddTreeSetToTreeInfo(tree_node, directory, top_dir, tree_type);
+
+ // update menu screen (and possibly change current level set)
+ DrawScreenAfterAddingSet(top_dir, tree_type);
+
+ return tree_type;
+}
+
+static void HandleDropTextEvent(char *text)
+{
+ Debug("event:droptext", "text == '%s'", text);
+}
+
+static void HandleDropCompleteEvent(int num_level_sets_succeeded,
+ int num_artwork_sets_succeeded,
+ int num_files_failed)
+{
+ // only show request dialog if no other request dialog already active
+ if (game.request_active)
+ return;
+
+ // this case can happen with drag-and-drop with older SDL versions
+ if (num_level_sets_succeeded == 0 &&
+ num_artwork_sets_succeeded == 0 &&
+ num_files_failed == 0)
+ return;
+
+ char message[100];
+
+ if (num_level_sets_succeeded > 0 || num_artwork_sets_succeeded > 0)
+ {
+ char message_part1[50];
+
+ sprintf(message_part1, "New %s set%s added",
+ (num_artwork_sets_succeeded == 0 ? "level" :
+ num_level_sets_succeeded == 0 ? "artwork" : "level and artwork"),
+ (num_level_sets_succeeded +
+ num_artwork_sets_succeeded > 1 ? "s" : ""));
+
+ if (num_files_failed > 0)
+ sprintf(message, "%s, but %d dropped file%s failed!",
+ message_part1, num_files_failed, num_files_failed > 1 ? "s" : "");
+ else
+ sprintf(message, "%s!", message_part1);
+ }
+ else if (num_files_failed > 0)
+ {
+ sprintf(message, "Failed to process dropped file%s!",
+ num_files_failed > 1 ? "s" : "");
+ }
+
+ Request(message, REQ_CONFIRM);