@@ -46,7 +46,7 @@ class MainWindow : public Gtk::ApplicationWindow
46
46
Gtk::Label *partialCount = nullptr ;
47
47
builder->get_widget (" partialCount" , partialCount);
48
48
49
- auto callback = [this , cylinderCount, sideLabel, goodCount, partialCount](const int currentTrack, const ArduinoFloppyReader::DiskSurface currentSide, const int retryCounter, const int sectorsFound, const int badSectorsFound) -> ArduinoFloppyReader::WriteResponse
49
+ auto readerCallback = [this , cylinderCount, sideLabel, goodCount, partialCount](const int currentTrack, const ArduinoFloppyReader::DiskSurface currentSide, const int retryCounter, const int sectorsFound, const int badSectorsFound) -> ArduinoFloppyReader::WriteResponse
50
50
{
51
51
std::string side = (currentSide == ArduinoFloppyReader::DiskSurface::dsUpper ? " Upper" : " Lower" );
52
52
std::cout << " currentTrack: " << currentTrack << " side: " << side << " retryCount: " << retryCounter << std::endl;
@@ -89,7 +89,7 @@ class MainWindow : public Gtk::ApplicationWindow
89
89
});
90
90
Gtk::RadioButton *trackButton = nullptr ;
91
91
builder->get_widget (" radio80" , trackButton);
92
- copyButton->signal_clicked ().connect ([this , fileEntry, folderButton, typeSelector, trackButton, callback , portsCombo]()
92
+ copyButton->signal_clicked ().connect ([this , fileEntry, folderButton, typeSelector, trackButton, readerCallback , portsCombo]()
93
93
{
94
94
Glib::ustring folder = folderButton->get_filename ();
95
95
Glib::ustring filename = folder + " /" + fileEntry->get_buffer ()->get_text ();
@@ -100,15 +100,48 @@ class MainWindow : public Gtk::ApplicationWindow
100
100
ArduinoFloppyReader::ADFResult readerResult;
101
101
if (typeSelector->get_active_text () == " ADF" )
102
102
{
103
- readerResult = writer.DiskToADF (std::wstring (filename.begin (), filename.end ()), tracks80 ? 80 : 82 , callback );
103
+ readerResult = writer.DiskToADF (std::wstring (filename.begin (), filename.end ()), tracks80 ? 80 : 82 , readerCallback );
104
104
}
105
105
else
106
106
{
107
- readerResult = writer.DiskToSCP (std::wstring (filename.begin (), filename.end ()), tracks80 ? 80 : 82 , 3 , callback );
107
+ readerResult = writer.DiskToSCP (std::wstring (filename.begin (), filename.end ()), tracks80 ? 80 : 82 , 3 , readerCallback );
108
108
}
109
109
// Handle the result
110
110
handleResult (writer, readerResult);
111
111
});
112
+
113
+ auto writerCallback = [this ](const int currentTrack, const ArduinoFloppyReader::DiskSurface currentSide, const bool isVerifyError) -> ArduinoFloppyReader::WriteResponse {
114
+ std::string side = (currentSide == ArduinoFloppyReader::DiskSurface::dsUpper ? " Upper" : " Lower" );
115
+ std::cout << " writing: currentTrack: " << currentTrack << " side: " << side << std::endl;
116
+
117
+ // if (isVerifyError) {
118
+ // switch (MessageBox(L"Verify error writing track.", L"Disk Write Error", MB_ABORTRETRYIGNORE)) {
119
+ // case IDABORT: return ArduinoFloppyReader::WriteResponse::wrAbort;
120
+ // case IDRETRY: return ArduinoFloppyReader::WriteResponse::wrRetry;
121
+ // case IDIGNORE: return ArduinoFloppyReader::WriteResponse::wrSkipBadChecksums;
122
+ // }
123
+ // }
124
+ // Just continue
125
+ return ArduinoFloppyReader::WriteResponse::wrContinue;
126
+ };
127
+ Gtk::Entry *writeFileEntry = nullptr ;
128
+ builder->get_widget (" writeFileEntry" , writeFileEntry);
129
+ Gtk::FileChooserButton *writeFolderSelector = nullptr ;
130
+ builder->get_widget (" writeFolderSelector" , writeFolderSelector);
131
+ Gtk::Button *writeButton = nullptr ;
132
+ builder->get_widget (" writeButton" , writeButton);
133
+ writeButton->signal_clicked ().connect ([this , writeFileEntry, writeFolderSelector, writerCallback, portsCombo]()
134
+ {
135
+ Glib::ustring folder = writeFolderSelector->get_filename ();
136
+ Glib::ustring filename = folder + " /" + writeFileEntry->get_buffer ()->get_text ();
137
+ ArduinoFloppyReader::ADFWriter writer;
138
+ Glib::ustring serial = portsCombo->get_active_text ();
139
+ writer.openDevice (std::wstring (serial.begin (), serial.end ()));
140
+ ArduinoFloppyReader::ADFResult readerResult;
141
+ readerResult = writer.ADFToDisk (std::wstring (filename.begin (), filename.end ()), false , false , writerCallback);
142
+ // Handle the result
143
+ handleResult (writer, readerResult);
144
+ });
112
145
}
113
146
114
147
virtual ~MainWindow () = default ;
@@ -182,7 +215,7 @@ private
182
215
}
183
216
}
184
217
}
185
-
218
+
186
219
bool showQuestion (bool isQuestion, const std::string question)
187
220
{
188
221
Gtk::ButtonsType buttons = Gtk::BUTTONS_OK_CANCEL;
0 commit comments