Skip to content

Commit c80f298

Browse files
committedJan 24, 2025
[#82] CAPS devices improvements and bugfixes (Part 9: MessageBar about unsupported features)
1 parent a469899 commit c80f298

File tree

9 files changed

+218
-178
lines changed

9 files changed

+218
-178
lines changed
 

‎Main/src/CapsBase.cpp

+7-9
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,6 @@
516516
::SetLastError( ERROR_CANCELLED );
517517
return FALSE;
518518
}
519-
// - warning on unsupported Cylinders
520-
WarnOnAndCorrectExceedingCylinders();
521519
// - successfully mounted
522520
return TRUE;
523521
}
@@ -956,14 +954,14 @@
956954
return false;
957955
}
958956

959-
void CCapsBase::WarnOnAndCorrectExceedingCylinders(){
960-
// if current # of Cylinders exceeds supported limit, shows a pop-up message and corrects the #
961-
if (capsImageInfo.maxcylinder>FDD_CYLINDERS_MAX){ // inclusive!
962-
TCHAR msg[200];
963-
::wsprintf( msg, _T("The image contains %d cylinders, ") _T(APP_ABBREVIATION) _T(" shows just first %d of them."), capsImageInfo.maxcylinder+1, FDD_CYLINDERS_MAX );
964-
Utils::Warning(msg);
965-
capsImageInfo.maxcylinder=FDD_CYLINDERS_MAX-1; // inclusive!
957+
CString CCapsBase::ListUnsupportedFeatures(){
958+
// returns a list of all features currently not properly implemented
959+
CString list;
960+
if (capsImageInfo.maxcylinder>FDD_CYLINDERS_MAX){ // inclusive! - current # of Cylinders exceeds supported limit
961+
list.Format( _T("- disk contains %d cylinders, ") _T(APP_ABBREVIATION) _T(" shows just first %d of them\n"), capsImageInfo.maxcylinder+1, FDD_CYLINDERS_MAX );
962+
capsImageInfo.maxcylinder=FDD_CYLINDERS_MAX-1; // inclusive! - correct # of Cylinders
966963
}
964+
return list + __super::ListUnsupportedFeatures();
967965
}
968966

969967
CCapsBase::PInternalTrack CCapsBase::GetModifiedTrackSafe(TCylinder cyl,THead head) const{

‎Main/src/CapsBase.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@
186186

187187
virtual TStdWinError UploadFirmware();
188188
virtual TStdWinError UploadTrack(TCylinder cyl,THead head,CTrackReader tr) const;
189-
void WarnOnAndCorrectExceedingCylinders();
190189
PInternalTrack GetInternalTrackSafe(TCylinder cyl,THead head) const;
191190
PInternalTrack GetModifiedTrackSafe(TCylinder cyl,THead head) const;
192191
bool AnyTrackModified(TCylinder cyl) const;
@@ -220,6 +219,7 @@
220219
bool RequiresFormattedTracksVerification() const override sealed;
221220
TStdWinError UnformatTrack(TCylinder cyl,THead head) override;
222221
TStdWinError MineTrack(TCylinder cyl,THead head) override sealed;
222+
CString ListUnsupportedFeatures() override;
223223
};
224224

225225

‎Main/src/HFE.cpp

+171-162
Large diffs are not rendered by default.

‎Main/src/HFE.h

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464

6565
bool IsValid() const;
6666
bool IsVersion3() const;
67+
CString ListUnsupportedFeatures() const;
6768
TLogTime GetCellTime() const;
6869
} header;
6970

@@ -126,6 +127,7 @@
126127
bool EditSettings(bool initialEditing) override;
127128
TStdWinError Reset() override;
128129
TStdWinError FormatTrack(TCylinder cyl,THead head,Codec::TType codec,TSector nSectors,PCSectorId bufferId,PCWORD bufferLength,PCFdcStatus bufferFdcStatus,BYTE gap3,BYTE fillerByte,const volatile bool &cancelled) override;
130+
CString ListUnsupportedFeatures() override;
129131
};
130132

131133
#endif // HFE_H

‎Main/src/Image.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,23 @@ namespace Medium{
557557

558558

559559

560+
CImage::CUnsupportedFeaturesMessageBar::CUnsupportedFeaturesMessageBar()
561+
// ctor
562+
: CMainWindow::CMessageBar( _T("The image contains <a>features currently not supported</a> by ") APP_ABBREVIATION _T(".") ) {
563+
}
564+
565+
void CImage::CUnsupportedFeaturesMessageBar::HyperlinkClicked(LPCWSTR id) const{
566+
Utils::Information(report);
567+
}
568+
569+
void CImage::CUnsupportedFeaturesMessageBar::Show(const CString &report){
570+
//
571+
if (!( this->report=report ).IsEmpty())
572+
__super::Show();
573+
}
574+
575+
576+
560577

561578

562579

@@ -609,6 +626,11 @@ namespace Medium{
609626
return ERROR_SUCCESS; // always succeeds (but may fail in CDos-derivates)
610627
}
611628

629+
CString CImage::ListUnsupportedFeatures(){
630+
// returns a list of all features currently not properly implemented
631+
return CString();
632+
}
633+
612634
void CImage::ToggleWriteProtection(){
613635
// toggles Image's WriteProtection flag
614636
// - cannot toggle if not allowed to write to the Image (e.g. because the Image has been opened from a CD-ROM)

‎Main/src/Image.h

+9
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,14 @@
324324
void SetReadOnlyReason(LPCTSTR readOnlyReason);
325325
} readOnlyMessageBar; // the reason why WriteProtection can't be removed
326326

327+
class CUnsupportedFeaturesMessageBar sealed:public CMainWindow::CMessageBar{
328+
CString report;
329+
void HyperlinkClicked(LPCWSTR id) const override;
330+
public:
331+
CUnsupportedFeaturesMessageBar();
332+
void Show(const CString &report);
333+
} unsupportedFeaturesMessageBar;
334+
327335
class CTrackReaderBase{
328336
public:
329337
enum TDecoderMethod:BYTE{
@@ -823,6 +831,7 @@
823831
virtual TStdWinError MineTrack(TCylinder cyl,THead head);
824832
virtual CSectorDataSerializer *CreateSectorDataSerializer(CHexaEditor *pParentHexaEditor)=0;
825833
virtual TStdWinError CreateUserInterface(HWND hTdi);
834+
virtual CString ListUnsupportedFeatures();
826835
void SetRedrawToAllViews(bool redraw) const;
827836
bool ReportWriteProtection() const;
828837
void ToggleWriteProtection();

‎Main/src/MainWindow.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@
107107
} *pTdi;
108108

109109
class CMessageBar:protected CStatusBar{
110-
static int D; // dimension
111-
const WCHAR glyph;
112110
HWND hGlyph,hSysLink,hCloseBtn;
113111
protected:
112+
static int D; // dimension
113+
const WCHAR glyph;
114+
CString msgHyperlink;
115+
114116
virtual void HyperlinkClicked(LPCWSTR id) const;
115117
LRESULT WindowProc(UINT msg,WPARAM wParam,LPARAM lParam) override;
116118
public:
117-
CString msgHyperlink;
118-
119119
CMessageBar(LPCTSTR msgHyperlink,WCHAR webdingsGlyph=L'\xf069');
120120
~CMessageBar();
121121

‎Main/src/SCP.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ formatError: ::SetLastError(ERROR_BAD_FORMAT);
8484
return FALSE;
8585
}
8686
header.flags.normalized|=params.corrections.valid&&params.corrections.use;
87-
// - warning on unsupported Cylinders
88-
WarnOnAndCorrectExceedingCylinders();
8987
return TRUE;
9088
}
9189

‎Main/src/editor.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,8 @@ openImage: if (image->OnOpenDocument(lpszFileName)){ // if opened successfully .
416416
image->SetPathName( lpszFileName, FALSE ); // at this moment, Image became application's active document and the name of its underlying file is shown in MainWindow's caption
417417
// - adding file Image into list of Most Recently Used (MRU) documents
418418
//nop (added by calling CDocument::SetPathName below)
419+
// - reporting about not properly implemented features of the Image
420+
image->unsupportedFeaturesMessageBar.Show( image->ListUnsupportedFeatures() );
419421
// - determining the DOS
420422
CDos::PCProperties dosProps=nullptr;
421423
TFormat formatBoot=TFormat::Unknown; // information on Format (# of Cylinders, etc.) obtained from Image's Boot record

0 commit comments

Comments
 (0)
Please sign in to comment.