Skip to content

Commit

Permalink
[#77] Data mining (Part 8: Button to list sectors to mine)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-nestorovic committed Jun 3, 2024
1 parent 05d5b5b commit cb3bcbe
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Main/res/resource.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1990,10 +1990,11 @@ BEGIN
DEFPUSHBUTTON "Start",IDOK,303,209,50,14
PUSHBUTTON "Cancel",IDCANCEL,356,209,50,14
LTEXT "Mining target:",IDC_STATIC,7,9,44,8,NOT WS_GROUP
COMBOBOX ID_ACCURACY,63,7,343,166,CBS_DROPDOWNLIST | WS_VSCROLL |
COMBOBOX ID_ACCURACY,63,7,324,166,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
PUSHBUTTON "",ID_SECTOR,390,7,16,13
LTEXT "Approach:",IDC_STATIC,7,25,34,8,NOT WS_GROUP
COMBOBOX ID_CREATOR,63,23,343,143,CBS_DROPDOWNLIST | WS_VSCROLL |
COMBOBOX ID_CREATOR,63,23,324,143,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
LTEXT "Static",ID_CHART,7,48,399,149,NOT WS_VISIBLE |
WS_BORDER | NOT WS_GROUP
Expand Down
12 changes: 12 additions & 0 deletions Main/src/CapsBase_Mining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
cbx.Detach();
if (const auto savedValue=app.GetProfileInt( INI_MINING, INI_TARGET, TARGET_NONE ))
SelectDlgComboBoxValue( ID_ACCURACY, savedValue, false );
SetDlgItemSingleCharUsingFont( ID_SECTOR, 0xf09d, FONT_WEBDINGS, 120 );
// . populating the "Mining approach" combo-box
cbx.Attach( GetDlgItemHwnd(ID_CREATOR) );
if (cb.properties->IsRealDevice())
Expand Down Expand Up @@ -232,6 +233,17 @@
// a significant error
Utils::FatalError( _T("Can't continue mining"), lParam );
return TRUE;
case ID_SECTOR:{
// message about the MiningTarget
miningTarget=(TMiningTarget)GetDlgComboBoxSelectedValue(ID_ACCURACY);
CString msg=_T("Target sectors:\n\n");
if (miningTarget&TARGET_ALL_STD_SECTORS_PRESENT)
msg+=cb.dos->ListStdSectors( cyl, head );
else if (miningTarget&TARGET_ALL_CURRENT_SECTORS_PRESENT)
msg+=cb.ListSectors( cyl, head );
Utils::Information(msg);
return TRUE;
}
}
return __super::OnCommand(wParam,lParam);
}
Expand Down
6 changes: 6 additions & 0 deletions Main/src/Dos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ reportError:Utils::Information(buf);
return formatBoot.nSectors;
}

CString CDos::ListStdSectors(TCylinder cyl,THead head) const{
// creates and returns a List of standard DOS Sector IDs
TSectorId ids[(TSector)-1];
return TSectorId::List( ids, GetListOfStdSectors(cyl,head,ids) );
}

TStdWinError CDos::IsTrackEmpty(TCylinder cyl,THead head,TSector nSectors,PCSectorId sectors) const{
// returns ERROR_EMPTY/ERROR_NOT_EMPTY or another Windows standard i/o error
TSectorStatus statuses[(TSector)-1],*ps=statuses;
Expand Down
1 change: 1 addition & 0 deletions Main/src/Dos.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@
// other
bool IsKnown() const;
TSector GetListOfStdSectors(TCylinder cyl,THead head,PSectorId bufferId) const;
CString ListStdSectors(TCylinder cyl,THead head) const;
virtual TStdWinError CreateUserInterface(HWND hTdi);
virtual enum TCmdResult:BYTE{
REFUSED =0, // not carried out (e.g. because cannot)
Expand Down

0 comments on commit cb3bcbe

Please sign in to comment.