Skip to content

Commit

Permalink
Current path display improvements
Browse files Browse the repository at this point in the history
- Ellipsize current path if it is too long to fit
- Show '/' instead of blank for root dir

Fix #1015
  • Loading branch information
Simon Judd committed Nov 19, 2019
1 parent 5ecfb9b commit 8b4f0e1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/MainEditor/UI/ArchivePanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,16 @@ ArchivePanel::ArchivePanel(wxWindow* parent, Archive* archive)


// Create path display
auto min_pad = UI::px(UI::Size::PadMinimum);
sizer_path_controls_ = new wxBoxSizer(wxHORIZONTAL);
framesizer->Add(sizer_path_controls_, 0, wxEXPAND|wxLEFT|wxRIGHT, UI::pad());
framesizer->AddSpacer(UI::px(UI::Size::PadMinimum));
framesizer->Add(sizer_path_controls_, 0, wxEXPAND | wxLEFT | wxRIGHT, UI::pad());
framesizer->AddSpacer(min_pad);

// Label
label_path_ = new wxStaticText(this, -1, "Path:", wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_START);
sizer_path_controls_->Add(label_path_, 1, wxRIGHT|wxALIGN_CENTER_VERTICAL, UI::pad());
label_path_ =
new wxStaticText(this, -1, "/", wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_START | wxST_NO_AUTORESIZE);
sizer_path_controls_->Add(new wxStaticText(this, -1, "Path:"), 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, min_pad);
sizer_path_controls_->Add(label_path_, 1, wxRIGHT | wxALIGN_CENTER_VERTICAL, UI::pad());

// 'Up' button
btn_updir_ = new SIconButton(this, Icons::ENTRY, "upfolder");
Expand Down Expand Up @@ -4060,15 +4063,14 @@ void ArchivePanel::onDirChanged(wxCommandEvent& e)
if (!dir->getParent())
{
// Root dir
label_path_->SetLabel("Path:");
label_path_->SetLabel("/");
btn_updir_->Enable(false);
}
else
{
// Setup path string
string path = dir->getPath();
path.Remove(0, 1);
path.Prepend("Path: ");

label_path_->SetLabel(path);
btn_updir_->Enable(true);
Expand Down

0 comments on commit 8b4f0e1

Please sign in to comment.