OrcaSlicer/src/slic3r/GUI/WebViewDialog.hpp
Aidan 17fec83e5b
Flatpak build (#4175)
* Initial commit for the builder

* fix wx, use hack to install into /app

* add some workarounds for /usr/local

* fix up rest of paths

* attempt to fix wxwebview undef

* figure out why wxwidgets isnt getting its patches applied

* do "proper" patching of wxwidgets

* Flip the flag

* actually append the /usr/local

* restrict package finding to flatpak only

* Update the destdir stuff for mpfr, gmp

* Transfer over all the _destdir, again

* update patch command for all other plats

* initial ci check

* what even happened

* clear ci image

* I doubt this will do anything

* do cleanup after running each step

* remove build objects for flatpak ci

* compress debug info

* Fix MacOS build

* Try saving space after building deps

* No debug info for now

* Do debug info, use thin static archives

* use BSD flag, not --thin

* try building with lto

* Use release, no debug info

* remove lto

* Revert the last 5 commits

* It might require write perms

* Revert "It might require write perms"

This reverts commit 44cec58a57.

* Import fixes for merge

* remove some patch stuff

* the worst hack!

* remove uneeded patches

* Initial commit for the builder

* note to self, go back to regular wx

* attempt to fix wxwebview undef

* do "proper" patching of wxwidgets

* update patch command for all other plats

* what even happened

* -ldep_name-NOTFOUND is still here

* concat patches

* Build wx with flatpak

* more wx shenatigans

* fix a missing import

* build wx with proper flags

* fix imports and libs

* trigger ci

* try fixing mac and windows ci

* remove duplicate definition of freetype

* curl may not have openssl for a dep

* has openssl been found?

* force building

* build images on apple

* cleanup for review

* cleanup cmake files

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
2024-05-25 09:11:19 +08:00

169 lines
4.9 KiB
C++

#ifndef slic3r_WebViewDialog_hpp_
#define slic3r_WebViewDialog_hpp_
#include "wx/artprov.h"
#include "wx/cmdline.h"
#include "wx/notifmsg.h"
#include "wx/settings.h"
#include <wx/webview.h>
#if wxUSE_WEBVIEW_EDGE
#include "wx/msw/webview_edge.h"
#endif
#include "wx/webviewarchivehandler.h"
#include "wx/webviewfshandler.h"
#include "wx/numdlg.h"
#include "wx/infobar.h"
#include "wx/filesys.h"
#include "wx/fs_arc.h"
#include "wx/fs_mem.h"
#include "wx/stdpaths.h"
#include <wx/panel.h>
#include <wx/tbarbase.h>
#include "wx/textctrl.h"
#include <wx/timer.h>
namespace Slic3r {
class NetworkAgent;
namespace GUI {
class WebViewPanel : public wxPanel
{
public:
WebViewPanel(wxWindow *parent);
virtual ~WebViewPanel();
void load_url(wxString& url);
void UpdateState();
void OnIdle(wxIdleEvent& evt);
void OnUrl(wxCommandEvent& evt);
void OnBack(wxCommandEvent& evt);
void OnForward(wxCommandEvent& evt);
void OnStop(wxCommandEvent& evt);
void OnReload(wxCommandEvent& evt);
void OnNavigationRequest(wxWebViewEvent& evt);
void OnNavigationComplete(wxWebViewEvent& evt);
void OnDocumentLoaded(wxWebViewEvent& evt);
void OnTitleChanged(wxWebViewEvent &evt);
void OnNewWindow(wxWebViewEvent& evt);
void OnScriptMessage(wxWebViewEvent& evt);
void OnScriptResponseMessage(wxCommandEvent& evt);
void OnViewSourceRequest(wxCommandEvent& evt);
void OnViewTextRequest(wxCommandEvent& evt);
void OnToolsClicked(wxCommandEvent& evt);
void OnError(wxWebViewEvent& evt);
void OnCut(wxCommandEvent& evt);
void OnCopy(wxCommandEvent& evt);
void OnPaste(wxCommandEvent& evt);
void OnUndo(wxCommandEvent& evt);
void OnRedo(wxCommandEvent& evt);
void OnMode(wxCommandEvent& evt);
void RunScript(const wxString& javascript);
void OnRunScriptString(wxCommandEvent& evt);
void OnRunScriptInteger(wxCommandEvent& evt);
void OnRunScriptDouble(wxCommandEvent& evt);
void OnRunScriptBool(wxCommandEvent& evt);
void OnRunScriptObject(wxCommandEvent& evt);
void OnRunScriptArray(wxCommandEvent& evt);
void OnRunScriptDOM(wxCommandEvent& evt);
void OnRunScriptUndefined(wxCommandEvent& evt);
void OnRunScriptNull(wxCommandEvent& evt);
void OnRunScriptDate(wxCommandEvent& evt);
void OnRunScriptMessage(wxCommandEvent& evt);
void OnRunScriptCustom(wxCommandEvent& evt);
void OnAddUserScript(wxCommandEvent& evt);
void OnSetCustomUserAgent(wxCommandEvent& evt);
void OnClearSelection(wxCommandEvent& evt);
void OnDeleteSelection(wxCommandEvent& evt);
void OnSelectAll(wxCommandEvent& evt);
void OnLoadScheme(wxCommandEvent& evt);
void OnUseMemoryFS(wxCommandEvent& evt);
void OnEnableContextMenu(wxCommandEvent& evt);
void OnEnableDevTools(wxCommandEvent& evt);
void OnClose(wxCloseEvent& evt);
wxTimer * m_LoginUpdateTimer{nullptr};
void OnFreshLoginStatus(wxTimerEvent &event);
public:
void SendRecentList(int images);
void SetLoginPanelVisibility(bool bshow);
void SendDesignStaffpick(bool on);
void OpenModelDetail(std::string id, NetworkAgent *agent);
void SendLoginInfo();
void ShowNetpluginTip();
void get_design_staffpick(int offset, int limit, std::function<void(std::string)> callback);
int get_model_mall_detail_url(std::string *url, std::string id);
void update_mode();
private:
wxWebView* m_browser;
wxBoxSizer *bSizer_toolbar;
wxButton * m_button_back;
wxButton * m_button_forward;
wxButton * m_button_stop;
wxButton * m_button_reload;
wxTextCtrl *m_url;
wxButton * m_button_tools;
wxMenu* m_tools_menu;
wxMenuItem* m_tools_handle_navigation;
wxMenuItem* m_tools_handle_new_window;
wxMenuItem* m_edit_cut;
wxMenuItem* m_edit_copy;
wxMenuItem* m_edit_paste;
wxMenuItem* m_edit_undo;
wxMenuItem* m_edit_redo;
wxMenuItem* m_edit_mode;
wxMenuItem* m_scroll_line_up;
wxMenuItem* m_scroll_line_down;
wxMenuItem* m_scroll_page_up;
wxMenuItem* m_scroll_page_down;
wxMenuItem* m_script_string;
wxMenuItem* m_script_integer;
wxMenuItem* m_script_double;
wxMenuItem* m_script_bool;
wxMenuItem* m_script_object;
wxMenuItem* m_script_array;
wxMenuItem* m_script_dom;
wxMenuItem* m_script_undefined;
wxMenuItem* m_script_null;
wxMenuItem* m_script_date;
wxMenuItem* m_script_message;
wxMenuItem* m_script_custom;
wxMenuItem* m_selection_clear;
wxMenuItem* m_selection_delete;
wxMenuItem* m_context_menu;
wxMenuItem* m_dev_tools;
wxInfoBar *m_info;
wxStaticText* m_info_text;
long m_zoomFactor;
// Last executed JavaScript snippet, for convenience.
wxString m_javascript;
wxString m_response_js;
DECLARE_EVENT_TABLE()
};
class SourceViewDialog : public wxDialog
{
public:
SourceViewDialog(wxWindow* parent, wxString source);
};
} // GUI
} // Slic3r
#endif /* slic3r_Tab_hpp_ */