aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qt-ui/divelogexportdialog.cpp8
-rw-r--r--worldmap-save.c20
-rw-r--r--worldmap-save.h2
3 files changed, 13 insertions, 17 deletions
diff --git a/qt-ui/divelogexportdialog.cpp b/qt-ui/divelogexportdialog.cpp
index 3ac9638ad..73f90678f 100644
--- a/qt-ui/divelogexportdialog.cpp
+++ b/qt-ui/divelogexportdialog.cpp
@@ -40,13 +40,7 @@ void DiveLogExportDialog::on_buttonBox_accepted()
filename = QFileDialog::getSaveFileName(this, tr("Export World Map"), fi.absolutePath(),
tr("HTML files (*.html)"));
if (!filename.isNull() && !filename.isEmpty())
- export_worldmap_HTML(filename.toUtf8().data());
- return;
- } else if (ui->exportWorldMap->isChecked()) {
- filename = QFileDialog::getSaveFileName(this, tr("Export World Map"), fi.absolutePath(),
- tr("HTML files (*.html)"));
- if (!filename.isNull() && !filename.isEmpty())
- export_worldmap_HTML(filename.toUtf8().data());
+ export_worldmap_HTML(filename.toUtf8().data(), ui->exportSelected->isChecked());
return;
}
diff --git a/worldmap-save.c b/worldmap-save.c
index e867846f5..21a0810b1 100644
--- a/worldmap-save.c
+++ b/worldmap-save.c
@@ -83,14 +83,16 @@ void put_HTML_notes(struct membuffer *b, struct dive *dive)
}
}
-void writeMarkers(struct membuffer *b)
+void writeMarkers(struct membuffer *b, const bool selected_only)
{
int i, dive_no = 0;
struct dive *dive;
for_each_dive(i, dive) {
- /*export selected dives only ?*/
-
+ if (selected_only) {
+ if (!dive->selected)
+ continue;
+ }
if (dive->latitude.udeg == 0 && dive->longitude.udeg == 0)
continue;
@@ -120,7 +122,7 @@ void insert_css(struct membuffer *b)
put_format(b, "<style type=\"text/css\">%s</style>\n", css);
}
-void insert_javascript(struct membuffer *b)
+void insert_javascript(struct membuffer *b, const bool selected_only)
{
put_string(b, "<script type=\"text/javascript\" src=\"");
put_string(b, getGoogleApi());
@@ -129,25 +131,25 @@ void insert_javascript(struct membuffer *b)
put_string(b, "rotateControl: false,\n\tstreetViewControl: false,\n\tmapTypeControl: false\n};\n");
put_string(b, "map = new google.maps.Map(document.getElementById(\"map-canvas\"),mapOptions);\nvar markers = new Array();");
put_string(b, "\nvar infowindows = new Array();\nvar temp;\nvar tempinfowindow;\n");
- writeMarkers(b);
+ writeMarkers(b, selected_only);
put_string(b, "\nfor(var i=0;i<markers.length;i++)\n\tmarkers[i].setMap(map);\n}\n");
put_string(b, "google.maps.event.addDomListener(window, 'load', initialize);</script>\n");
}
-void export(struct membuffer *b)
+void export(struct membuffer *b, const bool selected_only)
{
insert_html_header(b);
insert_css(b);
- insert_javascript(b);
+ insert_javascript(b, selected_only);
put_string(b, "\t</head>\n<body>\n<div id=\"map-canvas\"></div>\n</body>\n</html>");
}
-void export_worldmap_HTML(const char *file_name)
+void export_worldmap_HTML(const char *file_name, const bool selected_only)
{
FILE *f;
struct membuffer buf = { 0 };
- export(&buf);
+ export(&buf, selected_only);
f = fopen(file_name, "w+");
if (!f)
diff --git a/worldmap-save.h b/worldmap-save.h
index 72363e482..2aeaecd28 100644
--- a/worldmap-save.h
+++ b/worldmap-save.h
@@ -5,7 +5,7 @@
extern "C" {
#endif
-extern void export_worldmap_HTML(const char* x);
+extern void export_worldmap_HTML(const char* file_name, const bool selected_only);
#ifdef __cplusplus