diff --git a/resources/images/bar_publish.svg b/resources/images/bar_publish.svg
new file mode 100644
index 000000000..51e5cb2d2
--- /dev/null
+++ b/resources/images/bar_publish.svg
@@ -0,0 +1,3 @@
+
diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp
index 0613625bb..4ca0eedd2 100644
--- a/src/slic3r/GUI/GUI_App.cpp
+++ b/src/slic3r/GUI/GUI_App.cpp
@@ -2993,18 +2993,10 @@ void GUI_App::update_label_colours_from_appconfig()
void GUI_App::update_publish_status()
{
if (app_config->get_country_code() == "CN") {
-#ifdef __WINDOWS__
- mainframe->m_topbar->show_publish_button(false);
-#else
mainframe->show_publish_button(false);
-#endif
}
else {
-#ifdef __WINDOWS__
- mainframe->m_topbar->show_publish_button(true);
-#else
mainframe->show_publish_button(true);
-#endif
}
}
diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp
index 9fa99696e..b030ea9f4 100644
--- a/src/slic3r/GUI/MainFrame.cpp
+++ b/src/slic3r/GUI/MainFrame.cpp
@@ -864,19 +864,7 @@ void MainFrame::update_title()
void MainFrame::show_publish_button(bool show)
{
- if (!m_menubar) return;
-
- wxMenu* menu = m_menubar->GetMenu(3);
- auto title = menu->GetTitle();
-
- if (show) {
- if (title != wxString::Format("&%s", _L("3D Models"))) {
- m_menubar->Insert(3, publishMenu, wxString::Format("&%s", _L("3D Models")));
- }
- }
- else {
- m_menubar->Remove(3);
- }
+ m_publish_btn->Show(show);
}
void MainFrame::update_title_colour_after_set_title()
@@ -1443,14 +1431,18 @@ wxBoxSizer* MainFrame::create_side_tools()
m_slice_select = eSlicePlate;
m_print_select = ePrintPlate;
+ m_publish_btn = new Button(this, _L("Upload"), "bar_publish", 0, FromDIP(16));
m_slice_btn = new SideButton(this, _L("Slice plate"), "");
m_slice_option_btn = new SideButton(this, "", "sidebutton_dropdown", 0, FromDIP(14));
m_print_btn = new SideButton(this, _L("Print plate"), "");
m_print_option_btn = new SideButton(this, "", "sidebutton_dropdown", 0, FromDIP(14));
update_side_button_style();
+ m_publish_btn->Hide();
m_slice_option_btn->Enable();
m_print_option_btn->Enable();
+ sizer->Add(m_publish_btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(1));
+ sizer->Add(FromDIP(15), 0, 0, 0, 0);
sizer->Add(m_slice_option_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(1));
sizer->Add(m_slice_btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(1));
sizer->Add(FromDIP(15), 0, 0, 0, 0);
@@ -1460,6 +1452,23 @@ wxBoxSizer* MainFrame::create_side_tools()
sizer->Layout();
+ m_publish_btn->Bind(wxEVT_BUTTON, [this](auto& e) {
+ CallAfter([this] {
+ wxGetApp().open_publish_page_dialog();
+
+ if (!wxGetApp().getAgent()) {
+ BOOST_LOG_TRIVIAL(info) << "publish: no agent";
+ return;
+ }
+
+ // record
+ json j;
+ NetworkAgent* agent = GUI::wxGetApp().getAgent();
+ if (agent)
+ agent->track_event("enter_model_mall", j.dump());
+ });
+ });
+
m_slice_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event)
{
//this->m_plater->select_view_3D("Preview");
@@ -1817,6 +1826,18 @@ void MainFrame::update_side_button_style()
m_slice_btn->SetCornerRadius(FromDIP(12));
m_slice_btn->SetExtraSize(wxSize(FromDIP(38), FromDIP(10)));
m_slice_btn->SetBottomColour(wxColour(0x3B4446));*/
+ StateColor m_btn_bg_enable = StateColor(
+ std::pair(wxColour(27, 136, 68), StateColor::Pressed),
+ std::pair(wxColour(48, 221, 112), StateColor::Hovered),
+ std::pair(wxColour(0, 174, 66), StateColor::Normal)
+ );
+
+ m_publish_btn->SetMinSize(wxSize(FromDIP(125), FromDIP(24)));
+ m_publish_btn->SetCornerRadius(FromDIP(12));
+ m_publish_btn->SetBackgroundColor(m_btn_bg_enable);
+ m_publish_btn->SetBorderColor(m_btn_bg_enable);
+ m_publish_btn->SetBackgroundColour(wxColour(59,68,70));
+ m_publish_btn->SetTextColor(StateColor::darkModeColorFor("#FFFFFE"));
m_slice_btn->SetTextLayout(SideButton::EHorizontalOrientation::HO_Left, FromDIP(15));
m_slice_btn->SetCornerRadius(FromDIP(12));
@@ -2435,11 +2456,11 @@ void MainFrame::init_menubar_as_editor()
//publish menu
- if (m_plater) {
+ /*if (m_plater) {
publishMenu = new wxMenu();
add_common_publish_menu_items(publishMenu, this);
publishMenu->AppendSeparator();
- }
+ }*/
// View menu
wxMenu* viewMenu = nullptr;
@@ -2725,8 +2746,8 @@ void MainFrame::init_menubar_as_editor()
m_menubar->Append(editMenu, wxString::Format("&%s", _L("Edit")));
if (viewMenu)
m_menubar->Append(viewMenu, wxString::Format("&%s", _L("View")));
- if (publishMenu)
- m_menubar->Append(publishMenu, wxString::Format("&%s", _L("3D Models")));
+ //if (publishMenu)
+ // m_menubar->Append(publishMenu, wxString::Format("&%s", _L("3D Models")));
if (helpMenu)
m_menubar->Append(helpMenu, wxString::Format("&%s", _L("Help")));
SetMenuBar(m_menubar);
diff --git a/src/slic3r/GUI/MainFrame.hpp b/src/slic3r/GUI/MainFrame.hpp
index 6877fb09b..7cdbb54d1 100644
--- a/src/slic3r/GUI/MainFrame.hpp
+++ b/src/slic3r/GUI/MainFrame.hpp
@@ -94,7 +94,7 @@ class MainFrame : public DPIFrame
wxString m_last_config = wxEmptyString;
wxMenuBar* m_menubar{ nullptr };
- wxMenu* publishMenu{ nullptr };
+ //wxMenu* publishMenu{ nullptr };
#if 0
wxMenuItem* m_menu_item_repeat { nullptr }; // doesn't used now
@@ -373,6 +373,7 @@ public:
// BBS
mutable int m_print_select{ ePrintAll };
mutable int m_slice_select{ eSliceAll };
+ Button* m_publish_btn{ nullptr };
SideButton* m_slice_btn{ nullptr };
SideButton* m_slice_option_btn{ nullptr };
SideButton* m_print_btn{ nullptr };