From 66e0ee10200ba850087ac7d7dcaf1ef9a30c64b2 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 25 Dec 2022 21:33:48 +0100 Subject: [PATCH] Use icons at the top of the batch converter rather than text buttons at the bottom (#2396). --- graphics/add_black.png | Bin 0 -> 287 bytes graphics/add_white.png | Bin 0 -> 323 bytes graphics/pause_black.png | Bin 0 -> 263 bytes graphics/pause_white.png | Bin 0 -> 273 bytes graphics/src/batch_black.svg | 95 +++++++++++++++++++++++++++++++++++ graphics/src/batch_white.svg | 94 ++++++++++++++++++++++++++++++++++ graphics/update | 7 +++ src/tools/dcpomatic_batch.cc | 64 +++++++++++------------ 8 files changed, 229 insertions(+), 31 deletions(-) create mode 100644 graphics/add_black.png create mode 100644 graphics/add_white.png create mode 100644 graphics/pause_black.png create mode 100644 graphics/pause_white.png create mode 100644 graphics/src/batch_black.svg create mode 100644 graphics/src/batch_white.svg diff --git a/graphics/add_black.png b/graphics/add_black.png new file mode 100644 index 0000000000000000000000000000000000000000..60f5dae10fdfa83981c7b75f4decbe77727f29f7 GIT binary patch literal 287 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz&H|6fVg?4j!ywFfJby(BP*AeO zHKHUqKdq!Zu_%?Hyu4g5GcUV1Ik6yBFTW^#_B$IXprSRNE{-7)t#79|ay20?DOTF%N=CQ6UUE*2)mlJzGkCiCxvX_~__b^@`4;T$RXVguhe77Jqh>Ap z&040kwpEK(&4_$IqmDuF=f*n81M!&*JPnKn40frG9N#PV?Q7B9Yx(>=!|PpUyem`F zd@Cmur`<1qP|K>=lJ{BeYTYl#DM3zO>#Vv@Y;6nj3YMAwymIZsq8>w`zopr0KEi!1poj5 literal 0 HcmV?d00001 diff --git a/graphics/pause_black.png b/graphics/pause_black.png new file mode 100644 index 0000000000000000000000000000000000000000..e2584b796cb91226847a57787482ebcbb16875aa GIT binary patch literal 263 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz&H|6fVg?4j!ywFfJby(BP*AeO zHKHUqKdq!Zu_%?Hyu4g5GcUV1Ik6yBFTW^#_B$IXprR?BE{-7)t#79pay2^$xXypZ zu(M;rp$*4Rgxai5n0haHg{BdA;{gk`?8W~>nLq!3r_Fxk=FXfGY71EB`7L9TJ0L3Y z|HH3Gd_D)5O8nMsK9e#x^wk1~&lC4r?%cC_ZLrS*u4iWDi0`|GF3d0zE;eW$r2Yz6*UT=ZHBbRUDKtDnm{ Hr-UW|@DpVZ literal 0 HcmV?d00001 diff --git a/graphics/pause_white.png b/graphics/pause_white.png new file mode 100644 index 0000000000000000000000000000000000000000..6e2b181262bb23fb4b17515d21c17d27f2794b76 GIT binary patch literal 273 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz&H|6fVg?4j!ywFfJby(BP*AeO zHKHUqKdq!Zu_%?Hyu4g5GcUV1Ik6yBFTW^#_B$IXprU!6E{-7)t#7X#!vL!esXO;1o#V=PU)0>{C>|JhUE+{EdqzOi90a}u4Me( z*?+qD97Dr3sTq|wyA73=vM{XJn$)v#?%FEG_kTatY%Q1ia8}{~1DinuBToVYvxEby zz{ICNv)-GoT3gZ67^OX@_{HA+Zw-xISc?6wx~*Ze5u8=SwC`M*J?l{TT Rya&3J!PC{xWt~$(69689XYc?3 literal 0 HcmV?d00001 diff --git a/graphics/src/batch_black.svg b/graphics/src/batch_black.svg new file mode 100644 index 000000000..3affcc9e1 --- /dev/null +++ b/graphics/src/batch_black.svg @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + diff --git a/graphics/src/batch_white.svg b/graphics/src/batch_white.svg new file mode 100644 index 000000000..bf7bb0901 --- /dev/null +++ b/graphics/src/batch_white.svg @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/graphics/update b/graphics/update index f42c3182b..ff3baca04 100755 --- a/graphics/update +++ b/graphics/update @@ -101,6 +101,13 @@ else done done + # Batch converter toolbar icons (all platforms) + for c in black white; do + for i in add pause; do + inkbatch --inkscape $INKSCAPE -i batch-$i -o ${i}_${c}.png --width 32 --height 32 src/batch_$c.svg + done + done + # Playlist editor tick/no-tick $INKSCAPE_EXPORT --export-filename=tick.png src/tick.svg -w 16 -h 16 $INKSCAPE_EXPORT --export-filename=no_tick.png src/no_tick.svg -w 16 -h 16 diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc index 6e054edf8..8bb36476d 100644 --- a/src/tools/dcpomatic_batch.cc +++ b/src/tools/dcpomatic_batch.cc @@ -110,6 +110,11 @@ setup_menu (wxMenuBar* m) class DOMFrame : public wxFrame { public: + enum class Tool { + ADD, + PAUSE + }; + explicit DOMFrame (wxString const & title) : wxFrame (nullptr, -1, title) , _sizer (new wxBoxSizer(wxVERTICAL)) @@ -131,23 +136,21 @@ public: s->Add (panel, 1, wxEXPAND); SetSizer (s); - auto job_manager_view = new JobManagerView (panel, true); - _sizer->Add (job_manager_view, 1, wxALL | wxEXPAND, 6); + wxBitmap add(icon_path("add"), wxBITMAP_TYPE_PNG); + wxBitmap pause(icon_path("pause"), wxBITMAP_TYPE_PNG); - auto buttons = new wxBoxSizer (wxHORIZONTAL); - auto add = new Button (panel, _("Add Film...")); - add->Bind (wxEVT_BUTTON, boost::bind(&DOMFrame::add_film, this)); - buttons->Add (add, 1, wxALL, 6); - _pause = new Button (panel, _("Pause")); - _pause->Bind (wxEVT_BUTTON, boost::bind(&DOMFrame::pause, this)); - buttons->Add (_pause, 1, wxALL, 6); - _resume = new Button (panel, _("Resume")); - _resume->Bind (wxEVT_BUTTON, boost::bind(&DOMFrame::resume, this)); - buttons->Add (_resume, 1, wxALL, 6); + auto toolbar = new wxToolBar(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_HORIZONTAL); + toolbar->SetMargins(4, 4); + toolbar->SetToolBitmapSize(wxSize(32, 32)); + toolbar->AddTool(static_cast(Tool::ADD), _("Add film"), add, _("Add film for conversion")); + toolbar->AddCheckTool(static_cast(Tool::PAUSE), _("Pause/resume"), pause, wxNullBitmap, _("Pause or resume conversion")); + toolbar->Realize(); + _sizer->Add(toolbar, 0, wxALL, 6); - setup_sensitivity (); + toolbar->Bind(wxEVT_TOOL, bind(&DOMFrame::tool_clicked, this, _1)); - _sizer->Add (buttons, 0, wxALL, 6); + auto job_manager_view = new JobManagerView (panel, true); + _sizer->Add (job_manager_view, 1, wxALL | wxEXPAND, 6); panel->SetSizer (_sizer); @@ -155,22 +158,23 @@ public: Bind (wxEVT_SIZE, boost::bind(&DOMFrame::sized, this, _1)); } - void setup_sensitivity () - { - _pause->Enable (!JobManager::instance()->paused()); - _resume->Enable (JobManager::instance()->paused()); - } - - void pause () + void tool_clicked(wxCommandEvent& ev) { - JobManager::instance()->pause(); - setup_sensitivity (); - } - - void resume () - { - JobManager::instance()->resume(); - setup_sensitivity (); + switch (static_cast(ev.GetId())) { + case Tool::ADD: + add_film(); + break; + case Tool::PAUSE: + { + auto jm = JobManager::instance(); + if (jm->paused()) { + jm->resume(); + } else { + jm->pause(); + } + break; + } + } } void start_job (boost::filesystem::path path) @@ -354,8 +358,6 @@ private: wxSizer* _sizer; wxPreferencesEditor* _config_dialog = nullptr; ServersListDialog* _servers_list_dialog = nullptr; - wxButton* _pause; - wxButton* _resume; }; -- 2.30.2