File tree Expand file tree Collapse file tree 6 files changed +60
-5
lines changed
Expand file tree Collapse file tree 6 files changed +60
-5
lines changed Original file line number Diff line number Diff line change @@ -81,11 +81,11 @@ void Page::DoLoad(const wxtJson &json)
8181 return ;
8282 }
8383
84- if (json. is_object ()) {
85- PageParameterKeys keys ;
86- m_pageSettings->DoLoad (wxtGetJsonObjValue<wxtJson>(json , keys.settings , wxtJson::object ()));
87- m_pageIO->DoLoad (wxtGetJsonObjValue<wxtJson>(json , keys.io , wxtJson::object ()));
88- }
84+ PageParameterKeys keys;
85+ wxtJson params = json. is_object () ? json : wxtJson::object () ;
86+ m_pageSettings->DoLoad (wxtGetJsonObjValue<wxtJson>(params , keys.settings , wxtJson::object ()));
87+ m_pageIO->DoLoad (wxtGetJsonObjValue<wxtJson>(params , keys.io , wxtJson::object ()));
88+ m_pageTabs-> DoLoad (wxtGetJsonObjValue<wxtJson>(params, keys. tabs , wxtJson::object ()));
8989
9090 int format = m_pageSettings->GetInputSettings ()->GetTextFormat ();
9191 bool wrap = m_pageSettings->GetOutputSettings ()->GetWrap ();
@@ -104,6 +104,7 @@ wxtJson Page::DoSave() const
104104 PageParameterKeys keys;
105105 json[keys.settings ] = m_pageSettings->DoSave ();
106106 json[keys.io ] = m_pageIO->DoSave ();
107+ json[keys.tabs ] = m_pageTabs->DoSave ();
107108 return json;
108109}
109110
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ struct PageParameterKeys
1616{
1717 std::string io = {" io" };
1818 std::string settings = {" settings" };
19+ std::string tabs = {" tabs" };
1920};
2021
2122class PageIO ;
Original file line number Diff line number Diff line change @@ -51,6 +51,27 @@ LuaTab::LuaTab(wxWindow *parent)
5151
5252LuaTab::~LuaTab () {}
5353
54+ wxtJson LuaTab::DoSave () const
55+ {
56+ wxtJson json;
57+ LuaTabParameterKeys keys;
58+ json[keys.script ] = m_fileComboBox->GetValue ();
59+ return json;
60+ }
61+
62+ void LuaTab::DoLoad (const wxtJson ¶meters)
63+ {
64+ LuaTabParameterKeys keys;
65+ wxString script = wxtGetJsonObjValue<std::string>(parameters, keys.script , std::string (" " ));
66+ int index = m_fileComboBox->FindString (script);
67+ if (index == wxNOT_FOUND) {
68+ return ;
69+ }
70+
71+ m_fileComboBox->SetSelection (index);
72+ OnLuaFileComboBoxSelected ();
73+ }
74+
5475void LuaTab::OnBytesRead (std::shared_ptr<char > data, int size)
5576{
5677 if (data && size > 0 ) {
Original file line number Diff line number Diff line change 1616#include < wx/textctrl.h>
1717#include < wx/wx.h>
1818
19+ #include " Common/wxTools.h"
20+
21+ struct LuaTabParameterKeys
22+ {
23+ std::string script{" script" };
24+ };
25+
1926class LuaRunner ;
2027class LuaTab : public wxPanel
2128{
2229public:
2330 LuaTab (wxWindow *parent);
2431 ~LuaTab () override ;
2532
33+ wxtJson DoSave () const ;
34+ void DoLoad (const wxtJson ¶meters);
2635 void OnBytesRead (std::shared_ptr<char > data, int size);
2736
2837private:
Original file line number Diff line number Diff line change @@ -29,6 +29,20 @@ PageTabs::PageTabs(Page *parent)
2929
3030PageTabs::~PageTabs () {}
3131
32+ wxtJson PageTabs::DoSave () const
33+ {
34+ wxtJson json;
35+ PageTabsParameterKeys keys;
36+ json[keys.luaTab ] = m_luaTab->DoSave ();
37+ return json;
38+ }
39+
40+ void PageTabs::DoLoad (const wxtJson ¶meters)
41+ {
42+ PageTabsParameterKeys keys;
43+ m_luaTab->DoLoad (wxtGetJsonObjValue<wxtJson>(parameters, keys.luaTab , wxtJson::object ()));
44+ }
45+
3246void PageTabs::OnBytesRead (std::shared_ptr<char > data, int size)
3347{
3448 if (m_luaTab == nullptr ) {
Original file line number Diff line number Diff line change 1313#include < wx/notebook.h>
1414#include < wx/wx.h>
1515
16+ #include " Common/wxTools.h"
17+
18+ struct PageTabsParameterKeys
19+ {
20+ const std::string luaTab{" luaTab" };
21+ };
22+
1623class Page ;
1724class LuaTab ;
1825class PageTabs : public wxNotebook
@@ -21,6 +28,8 @@ class PageTabs : public wxNotebook
2128 PageTabs (Page *parent);
2229 ~PageTabs () override ;
2330
31+ wxtJson DoSave () const ;
32+ void DoLoad (const wxtJson ¶meters);
2433 void OnBytesRead (std::shared_ptr<char > data, int size);
2534
2635private:
You can’t perform that action at this time.
0 commit comments