Skip to content

Commit

Permalink
Display amount of cells selected in status bar (#777)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiolo authored Dec 9, 2024
1 parent 15d5f58 commit bbff91e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/document.h
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@ struct Document {
hover.g = nullptr;
redrawpending = true;
sys->UpdateStatus(selected);
sys->UpdateAmountStatus(selected);
#ifdef __WXGTK__
// wxWidgets (wxGTK) does not always automatically update the scrollbar
// to new canvas size and current position within after zoom so force it manually
Expand Down
6 changes: 3 additions & 3 deletions src/myframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ struct MyFrame : wxFrame {

ConstructToolBar();

wxStatusBar *sb = CreateStatusBar(4);
wxStatusBar *sb = CreateStatusBar(5);
SetStatusBarPane(0);
SetDPIAwareStatusWidths();
sb->Show(sys->showstatusbar);
Expand Down Expand Up @@ -1136,8 +1136,8 @@ struct MyFrame : wxFrame {
}

void SetDPIAwareStatusWidths() {
int swidths[] = {-1, FromDIP(300), FromDIP(120), FromDIP(100)};
SetStatusWidths(4, swidths);
int swidths[] = {-1, FromDIP(300), FromDIP(120), FromDIP(100), FromDIP(150)};
SetStatusWidths(5, swidths);
}

void OnDPIChanged(wxDPIChangedEvent &dce) {
Expand Down
6 changes: 6 additions & 0 deletions src/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,12 @@ struct System {
}
}

void UpdateAmountStatus(Selection &s) {
if (frame->GetStatusBar()) {
frame->SetStatusText(wxString::Format(_(L"%d cells"), s.xs * s.ys), 4);
}
}

void SaveCheck() {
loop(i, frame->nb->GetPageCount()) {
((TSCanvas *)frame->nb->GetPage(i))->doc->AutoSave(!frame->IsActive(), i);
Expand Down

0 comments on commit bbff91e

Please sign in to comment.