Skip to content

Commit

Permalink
set erase and update flags when a file has changed and the page gets …
Browse files Browse the repository at this point in the history
…reloaded by filemonitor
  • Loading branch information
ZXGuesser committed Jul 17, 2019
1 parent 078a3b2 commit 58e0585
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions filemonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ void FileMonitor::run()
// lock
q->LoadPage(name); // What if this fails? We can see the bool. What to do ?
q->IncrementUpdateCount();
q->SetFileChangedFlag();
q->GetPageCount(); // renumber the subpages
int mag=(q->GetPageNumber() >> 16) & 0x7;

Expand Down
2 changes: 2 additions & 0 deletions packetmag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ Packet* PacketMag::GetPacket(Packet* p)
if (_page->Changed())
{
_status|=PAGESTATUS_C8_UPDATE;

_status|=PAGESTATUS_C4_ERASEPAGE; // also set the erase flag
}
}

Expand Down
3 changes: 2 additions & 1 deletion ttxpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ TTXPage::TTXPage(std::string filename) :

bool TTXPage::Changed()
{
bool changed=false;
bool changed=_fileChanged; // begin with file change state
_fileChanged=false; // clear the flag
for (uint8_t row=1;row<=MAXROW;row++)
{
TTXLine* line=GetRow(row);
Expand Down
4 changes: 4 additions & 0 deletions ttxpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ class TTXPage
* This is NOT the same as pageChanged.
*/
bool Changed();

void SetFileChangedFlag(){_fileChanged=true;};

void SetSelected(bool value){_Selected=value;}; /// Set the selected state to value
bool Selected(){return _Selected;}; /// Return the selected state
Expand Down Expand Up @@ -286,6 +288,8 @@ class TTXPage
bool m_LoadTTX(std::string filename);

bool _Selected; /// True if this page has been selected.

bool _fileChanged; // page was reloaded by the filemonitor

};

Expand Down

0 comments on commit 58e0585

Please sign in to comment.