summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-07-25 20:24:20 +0100
committerCarl Hetherington <cth@carlh.net>2012-07-25 20:24:20 +0100
commit36d44180863cdbb5ef0e7e2f45794963047d07d4 (patch)
treeb614d471d80fdd4dedf8c3c2bb7743f94e253887 /src
parent9d9e1be1442cd98f6c1036d7c797422fe6b4652e (diff)
Various fixes.
Diffstat (limited to 'src')
-rw-r--r--src/wx/film_viewer.cc28
-rw-r--r--src/wx/job_manager_view.cc39
-rw-r--r--src/wx/job_manager_view.h1
3 files changed, 32 insertions, 36 deletions
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index b1af469a8..0a077265e 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -64,15 +64,19 @@ public:
return;
}
- resize ();
+ setup ();
}
- void resize ()
+ void setup ()
{
+ if (!_film || !_image) {
+ return;
+ }
+
int vw, vh;
GetSize (&vw, &vh);
- float const target = _film->format()->ratio_as_float ();
+ float const target = _film->format() ? _film->format()->ratio_as_float () : 1.78;
_cropped_image = _image->GetSubImage (
wxRect (_left_crop, _top_crop, _image->GetWidth() - (_left_crop + _right_crop), _image->GetHeight() - (_top_crop + _bottom_crop))
@@ -96,7 +100,7 @@ public:
{
delete _image;
_image = new wxImage (wxString (f.c_str(), wxConvUTF8));
- resize ();
+ setup ();
}
void set_crop (int l, int r, int t, int b)
@@ -105,7 +109,17 @@ public:
_right_crop = r;
_top_crop = t;
_bottom_crop = b;
- resize ();
+ setup ();
+ }
+
+ void set_film (Film* f)
+ {
+ _film = f;
+ if (!_film) {
+ clear ();
+ } else {
+ setup ();
+ }
}
void clear ()
@@ -204,15 +218,15 @@ void
FilmViewer::set_film (Film* f)
{
_film = f;
+ _thumb_panel->set_film (_film);
if (!_film) {
- _thumb_panel->clear ();
return;
}
_film->Changed.connect (sigc::mem_fun (*this, &FilmViewer::film_changed));
-
film_changed (Film::THUMBS);
+ reload_current_thumbnail ();
}
void
diff --git a/src/wx/job_manager_view.cc b/src/wx/job_manager_view.cc
index 9938d3a88..16a3e4afe 100644
--- a/src/wx/job_manager_view.cc
+++ b/src/wx/job_manager_view.cc
@@ -35,19 +35,10 @@ using namespace boost;
JobManagerView::JobManagerView (wxWindow* parent)
: wxPanel (parent)
{
- _sizer = new wxFlexGridSizer (2, 6, 6);
+ _sizer = new wxFlexGridSizer (3, 6, 6);
+ _sizer->AddGrowableCol (1, 1);
SetSizer (_sizer);
-#if 0
- add_label_to_sizer (_sizer, this, "Hello world");
- wxGauge* g = new wxGauge (this, wxID_ANY, 100);
- _sizer->Add (g, 1, wxEXPAND | wxALL);
-
- add_label_to_sizer (_sizer, this, "Shit");
- g = new wxGauge (this, wxID_ANY, 100);
- _sizer->Add (g, 1, wxEXPAND | wxALL);
-#endif
-
Connect (wxID_ANY, wxEVT_TIMER, wxTimerEventHandler (JobManagerView::periodic), 0, this);
_timer.reset (new wxTimer (this));
_timer->Start (1000);
@@ -76,23 +67,23 @@ JobManagerView::update ()
JobRecord r;
r.gauge = new wxGauge (this, wxID_ANY, 100);
+ _sizer->Add (r.gauge, 1, wxEXPAND);
r.informed_of_finish = false;
+ r.message = add_label_to_sizer (_sizer, this, "");
- _sizer->Add (r.gauge, 1, wxEXPAND);
_job_records[*i] = r;
_sizer->Layout ();
}
- bool inform_of_finish = false;
string const st = (*i)->status ();
if (!(*i)->finished ()) {
float const p = (*i)->overall_progress ();
if (p >= 0) {
-// r[_columns.text] = st;
+ _job_records[*i].message->SetLabel (std_to_wx (st));
_job_records[*i].gauge->SetValue (p * 100);
} else {
-// r[_columns.text] = "Running";
+ _job_records[*i].message->SetLabel (wxT ("Running"));
_job_records[*i].gauge->Pulse ();
}
}
@@ -102,21 +93,10 @@ JobManagerView::update ()
from here (the GUI thread).
*/
- if ((*i)->finished_ok ()) {
- if (!_job_records[*i].informed_of_finish) {
- _job_records[*i].gauge->SetValue (100);
-// r[_columns.text] = st;
- inform_of_finish = true;
- }
- } else if ((*i)->finished_in_error ()) {
- if (!_job_records[*i].informed_of_finish) {
- _job_records[*i].gauge->SetValue (100);
-// r[_columns.text] = st;
- inform_of_finish = true;
- }
- }
+ if ((*i)->finished () && !_job_records[*i].informed_of_finish) {
+ _job_records[*i].gauge->SetValue (100);
+ _job_records[*i].message->SetLabel (std_to_wx (st));
- if (inform_of_finish) {
try {
(*i)->emit_finished ();
} catch (OpenFileError& e) {
@@ -124,6 +104,7 @@ JobManagerView::update ()
s << "Error: " << e.what();
error_dialog (this, s.str ());
}
+
_job_records[*i].informed_of_finish = true;
}
}
diff --git a/src/wx/job_manager_view.h b/src/wx/job_manager_view.h
index ef74b3cf8..16fd7a3dc 100644
--- a/src/wx/job_manager_view.h
+++ b/src/wx/job_manager_view.h
@@ -44,6 +44,7 @@ private:
wxFlexGridSizer* _sizer;
struct JobRecord {
wxGauge* gauge;
+ wxStaticText* message;
bool informed_of_finish;
};