Skip to content

Commit 70d074d

Browse files
committed
Add no transition option
1 parent 077237a commit 70d074d

File tree

9 files changed

+173
-31
lines changed

9 files changed

+173
-31
lines changed

.vscode/tasks.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,21 @@
33
// for the documentation about the tasks.json format
44
"version": "2.0.0",
55
"tasks": [
6+
{
7+
"label": "config",
8+
"type": "process",
9+
"command": "${workspaceFolder}\\build\\install\\MultiScreenSaver.scr",
10+
"options": {
11+
"cwd": "${workspaceFolder}\\gui"
12+
}
13+
},
614
{
715
"label": "run",
816
"type": "process",
9-
"command": "${workspaceFolder}\\build\\install\\app.exe",
17+
"command": "${workspaceFolder}\\build\\install\\MultiScreenSaver.scr",
18+
"args": [
19+
"-s"
20+
],
1021
"options": {
1122
"cwd": "${workspaceFolder}\\gui"
1223
}

gui/config.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Config::Config()
2828
portraitDir = reg.Read("portraitDir", "");
2929
recursive = reg.ReadBool("recursive", true);
3030
scale = static_cast<SCALE>(reg.ReadLong("scale", SCALE::FILL));
31+
transition = static_cast<TRANSITION>(reg.ReadLong("transition", TRANSITION::BLEND));
3132
period = reg.ReadLong("period", 10);
3233
margins = reg.ReadLong("margins", 0);
3334
stagger = reg.ReadBool("stagger", false);
@@ -41,6 +42,7 @@ void Config::SaveToRegistry()
4142
reg.Write("portraitDir", portraitDir);
4243
reg.Write("recursive", recursive);
4344
reg.Write("scale", static_cast<long>(scale));
45+
reg.Write("transition", static_cast<long>(transition));
4446
reg.Write("period", period);
4547
reg.Write("margins", margins);
4648
reg.Write("stagger", stagger);
@@ -52,6 +54,7 @@ CONFIG_DIALOG::CONFIG_DIALOG(Config& config) : CONFIG_BASE(nullptr), m_config(co
5254
m_portraitDir->SetPath(m_config.portraitDir);
5355
m_recursiveScan->SetValue(m_config.recursive);
5456
m_scale->SetSelection(static_cast<long>(m_config.scale));
57+
m_transition->SetSelection(static_cast<long>(m_config.transition));
5558
m_period->SetValue(m_config.period);
5659
m_margins->SetValue(m_config.margins);
5760
m_stagger->SetValue(m_config.stagger);
@@ -66,6 +69,7 @@ void CONFIG_DIALOG::OnClose(wxCloseEvent& e)
6669
m_config.portraitDir = m_portraitDir->GetPath();
6770
m_config.recursive = m_recursiveScan->GetValue();
6871
m_config.scale = static_cast<Config::SCALE>(m_scale->GetSelection());
72+
m_config.transition = static_cast<Config::TRANSITION>(m_transition->GetSelection());
6973
m_config.period = m_period->GetValue();
7074
m_config.margins = m_margins->GetValue();
7175
m_config.stagger = m_stagger->GetValue();

gui/config.fbp

Lines changed: 113 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -676,22 +676,127 @@
676676
</object>
677677
<object class="sizeritem" expanded="1">
678678
<property name="border">5</property>
679-
<property name="flag"></property>
679+
<property name="flag">wxALL</property>
680680
<property name="proportion">0</property>
681-
<object class="spacer" expanded="1">
682-
<property name="height">0</property>
681+
<object class="wxStaticText" expanded="1">
682+
<property name="BottomDockable">1</property>
683+
<property name="LeftDockable">1</property>
684+
<property name="RightDockable">1</property>
685+
<property name="TopDockable">1</property>
686+
<property name="aui_layer"></property>
687+
<property name="aui_name"></property>
688+
<property name="aui_position"></property>
689+
<property name="aui_row"></property>
690+
<property name="best_size"></property>
691+
<property name="bg"></property>
692+
<property name="caption"></property>
693+
<property name="caption_visible">1</property>
694+
<property name="center_pane">0</property>
695+
<property name="close_button">1</property>
696+
<property name="context_help"></property>
697+
<property name="context_menu">1</property>
698+
<property name="default_pane">0</property>
699+
<property name="dock">Dock</property>
700+
<property name="dock_fixed">0</property>
701+
<property name="docking">Left</property>
702+
<property name="enabled">1</property>
703+
<property name="fg"></property>
704+
<property name="floatable">1</property>
705+
<property name="font"></property>
706+
<property name="gripper">0</property>
707+
<property name="hidden">0</property>
708+
<property name="id">wxID_ANY</property>
709+
<property name="label">Transition</property>
710+
<property name="markup">0</property>
711+
<property name="max_size"></property>
712+
<property name="maximize_button">0</property>
713+
<property name="maximum_size"></property>
714+
<property name="min_size"></property>
715+
<property name="minimize_button">0</property>
716+
<property name="minimum_size"></property>
717+
<property name="moveable">1</property>
718+
<property name="name">m_staticText9</property>
719+
<property name="pane_border">1</property>
720+
<property name="pane_position"></property>
721+
<property name="pane_size"></property>
683722
<property name="permission">protected</property>
684-
<property name="width">0</property>
723+
<property name="pin_button">1</property>
724+
<property name="pos"></property>
725+
<property name="resize">Resizable</property>
726+
<property name="show">1</property>
727+
<property name="size"></property>
728+
<property name="style"></property>
729+
<property name="subclass">; ; forward_declare</property>
730+
<property name="toolbar_pane">0</property>
731+
<property name="tooltip"></property>
732+
<property name="window_extra_style"></property>
733+
<property name="window_name"></property>
734+
<property name="window_style"></property>
735+
<property name="wrap">-1</property>
685736
</object>
686737
</object>
687738
<object class="sizeritem" expanded="1">
688739
<property name="border">5</property>
689-
<property name="flag"></property>
740+
<property name="flag">wxALL|wxEXPAND</property>
690741
<property name="proportion">0</property>
691-
<object class="spacer" expanded="1">
692-
<property name="height">0</property>
742+
<object class="wxChoice" expanded="1">
743+
<property name="BottomDockable">1</property>
744+
<property name="LeftDockable">1</property>
745+
<property name="RightDockable">1</property>
746+
<property name="TopDockable">1</property>
747+
<property name="aui_layer"></property>
748+
<property name="aui_name"></property>
749+
<property name="aui_position"></property>
750+
<property name="aui_row"></property>
751+
<property name="best_size"></property>
752+
<property name="bg"></property>
753+
<property name="caption"></property>
754+
<property name="caption_visible">1</property>
755+
<property name="center_pane">0</property>
756+
<property name="choices">&quot;None&quot; &quot;Blend&quot;</property>
757+
<property name="close_button">1</property>
758+
<property name="context_help"></property>
759+
<property name="context_menu">1</property>
760+
<property name="default_pane">0</property>
761+
<property name="dock">Dock</property>
762+
<property name="dock_fixed">0</property>
763+
<property name="docking">Left</property>
764+
<property name="enabled">1</property>
765+
<property name="fg"></property>
766+
<property name="floatable">1</property>
767+
<property name="font"></property>
768+
<property name="gripper">0</property>
769+
<property name="hidden">0</property>
770+
<property name="id">wxID_ANY</property>
771+
<property name="max_size"></property>
772+
<property name="maximize_button">0</property>
773+
<property name="maximum_size"></property>
774+
<property name="min_size"></property>
775+
<property name="minimize_button">0</property>
776+
<property name="minimum_size"></property>
777+
<property name="moveable">1</property>
778+
<property name="name">m_transition</property>
779+
<property name="pane_border">1</property>
780+
<property name="pane_position"></property>
781+
<property name="pane_size"></property>
693782
<property name="permission">protected</property>
694-
<property name="width">0</property>
783+
<property name="pin_button">1</property>
784+
<property name="pos"></property>
785+
<property name="resize">Resizable</property>
786+
<property name="selection">1</property>
787+
<property name="show">1</property>
788+
<property name="size"></property>
789+
<property name="style"></property>
790+
<property name="subclass">; ; forward_declare</property>
791+
<property name="toolbar_pane">0</property>
792+
<property name="tooltip"></property>
793+
<property name="validator_data_type"></property>
794+
<property name="validator_style">wxFILTER_NONE</property>
795+
<property name="validator_type">wxDefaultValidator</property>
796+
<property name="validator_variable"></property>
797+
<property name="window_extra_style"></property>
798+
<property name="window_name"></property>
799+
<property name="window_style"></property>
695800
</object>
696801
</object>
697802
<object class="sizeritem" expanded="1">

gui/config.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ struct Config
3333
FIT,
3434
ORIGINAL,
3535
} scale;
36+
enum TRANSITION
37+
{
38+
NONE,
39+
BLEND,
40+
} transition;
3641
int period;
3742
int margins;
3843
bool stagger;

gui/config_base.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,15 @@ CONFIG_BASE::CONFIG_BASE( wxWindow* parent, wxWindowID id, const wxString& title
7676
m_scale->SetSelection( 0 );
7777
fgSizer2->Add( m_scale, 0, wxALL|wxEXPAND, 5 );
7878

79-
80-
fgSizer2->Add( 0, 0, 0, 0, 5 );
81-
82-
83-
fgSizer2->Add( 0, 0, 0, 0, 5 );
79+
m_staticText9 = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, wxT("Transition"), wxDefaultPosition, wxDefaultSize, 0 );
80+
m_staticText9->Wrap( -1 );
81+
fgSizer2->Add( m_staticText9, 0, wxALL, 5 );
82+
83+
wxString m_transitionChoices[] = { wxT("None"), wxT("Blend") };
84+
int m_transitionNChoices = sizeof( m_transitionChoices ) / sizeof( wxString );
85+
m_transition = new wxChoice( sbSizer2->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_transitionNChoices, m_transitionChoices, 0 );
86+
m_transition->SetSelection( 1 );
87+
fgSizer2->Add( m_transition, 0, wxALL|wxEXPAND, 5 );
8488

8589
m_staticText3 = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, wxT("Update period (sec)"), wxDefaultPosition, wxDefaultSize, 0 );
8690
m_staticText3->Wrap( -1 );

gui/config_base.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ class CONFIG_BASE : public wxFrame
4444
wxCheckBox* m_recursiveScan;
4545
wxStaticText* m_staticText5;
4646
wxChoice* m_scale;
47+
wxStaticText* m_staticText9;
48+
wxChoice* m_transition;
4749
wxStaticText* m_staticText3;
4850
wxSpinCtrl* m_period;
4951
wxStaticText* m_staticText4;

main.cpp

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ bool App::OnInit()
9292
wnd->SetHWND((WXHWND)m_previewHwnd);
9393
#pragma warning(pop)
9494

95-
RenderWindow* renderer = new RenderWindow(wnd, m_config.landscapeDir, m_config.recursive, m_config.scale);
95+
RenderWindow* renderer =
96+
new RenderWindow(wnd, m_config.landscapeDir, m_config.recursive, m_config.scale, m_config.transition);
9697
m_renderers.push_back(renderer);
9798
SetTopWindow(renderer);
9899
renderer->Show();
@@ -111,7 +112,7 @@ bool App::OnInit()
111112
(rect.right - rect.left > rect.bottom - rect.top) ? m_config.landscapeDir : m_config.portraitDir;
112113

113114
SaverFrame* frame = new SaverFrame(
114-
path, m_config.recursive, m_config.scale,
115+
path, m_config.recursive, m_config.scale, m_config.transition,
115116
wxPoint(rect.left + m_config.margins, rect.top + m_config.margins),
116117
wxSize(rect.right - rect.left - 2 * m_config.margins, rect.bottom - rect.top - 2 * m_config.margins));
117118

@@ -169,10 +170,13 @@ void App::switchImage(bool forward)
169170

170171
RenderWindow* renderer = m_renderers[m_updateRenderer];
171172

172-
for (double tick = 0.02; tick < 1.0; tick += .02)
173+
if (m_config.transition != Config::TRANSITION::NONE)
173174
{
174-
renderer->Transition(forward, tick);
175-
wxMilliSleep(16);
175+
for (double tick = 0.02; tick < 1.0; tick += .02)
176+
{
177+
renderer->Transition(forward, tick);
178+
wxMilliSleep(16);
179+
}
176180
}
177181

178182
renderer->Increment(forward);
@@ -184,11 +188,14 @@ void App::switchImage(bool forward)
184188
}
185189
else
186190
{
187-
for (double tick = 0.02; tick < 1.0; tick += .02)
191+
if (m_config.transition != Config::TRANSITION::NONE)
188192
{
189-
for (const auto& renderer : m_renderers)
190-
renderer->Transition(forward, tick);
191-
wxMilliSleep(16);
193+
for (double tick = 0.02; tick < 1.0; tick += .02)
194+
{
195+
for (const auto& renderer : m_renderers)
196+
renderer->Transition(forward, tick);
197+
wxMilliSleep(16);
198+
}
192199
}
193200
for (const auto& renderer : m_renderers)
194201
{

saverframe.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ class ImageScanner : public wxDirTraverser
6262
wxArrayString& files;
6363
};
6464

65-
RenderWindow::RenderWindow(wxWindow* parent, const wxString& aPath, const bool aRecursive, const Config::SCALE aScale)
66-
: wxWindow(parent, wxID_ANY, wxPoint(0, 0), wxDefaultSize, wxBORDER_NONE), m_scaleMode(aScale)
65+
RenderWindow::RenderWindow(wxWindow* parent, const wxString& aPath, const bool aRecursive, const Config::SCALE aScale,
66+
const Config::TRANSITION aTransition)
67+
: wxWindow(parent, wxID_ANY, wxPoint(0, 0), wxDefaultSize, wxBORDER_NONE), m_scaleMode(aScale),
68+
m_transition(aTransition)
6769
{
6870
m_renderer = wxGraphicsRenderer::GetDirect2DRenderer();
6971

@@ -174,12 +176,12 @@ void RenderWindow::LoadNextImage(bool forward)
174176
m_originalImgSizes[bitmapIndex] = img.GetSize();
175177
}
176178

177-
SaverFrame::SaverFrame(const wxString& aPath, const bool aRecursive, const Config::SCALE aScale, const wxPoint& aPos,
178-
const wxSize& aSize)
179+
SaverFrame::SaverFrame(const wxString& aPath, const bool aRecursive, const Config::SCALE aScale,
180+
const Config::TRANSITION aTransition, const wxPoint& aPos, const wxSize& aSize)
179181
: wxFrame(nullptr, wxID_ANY, "MultiScreenSaver", aPos, aSize, 0 /*wxSTAY_ON_TOP */)
180182
{
181183
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
182-
renderer = new RenderWindow(this, aPath, aRecursive, aScale);
184+
renderer = new RenderWindow(this, aPath, aRecursive, aScale, aTransition);
183185
sizer->Add(renderer, 1, wxGROW, 0);
184186
SetSizer(sizer);
185187
Layout();

0 commit comments

Comments
 (0)