1st installment of preview ported in c++

This commit is contained in:
Enrico Turri
2018-09-18 13:35:05 +02:00
parent 5fa99fd903
commit e3e5948982
13 changed files with 718 additions and 10 deletions

View File

@@ -46,6 +46,10 @@
#include "Tab.hpp"
#include "TabIface.hpp"
//##############################################################################################################################################################
#include "GUI_Preview.hpp"
#include "GUI_PreviewIface.hpp"
//##############################################################################################################################################################
#include "AboutDialog.hpp"
#include "AppConfig.hpp"
#include "ConfigSnapshotDialog.hpp"
@@ -148,6 +152,10 @@ wxStaticBitmap *g_manifold_warning_icon = nullptr;
bool g_show_print_info = false;
bool g_show_manifold_warning_icon = false;
//##############################################################################################################################################################
PreviewIface* g_preview = nullptr; // <<< FIXME ENRICO -> add code to delete the pointer when the application closes
//##############################################################################################################################################################
static void init_label_colours()
{
auto luma = get_colour_approx_luma(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
@@ -665,6 +673,19 @@ TabIface* get_preset_tab_iface(char *name)
return new TabIface(nullptr);
}
//##############################################################################################################################################################
PreviewIface* create_preview_iface(wxNotebook* parent, DynamicPrintConfig* config, Print* print, GCodePreviewData* gcode_preview_data)
{
if (g_preview == nullptr)
{
Preview* panel = new Preview(parent, config, print, gcode_preview_data);
g_preview = new PreviewIface(panel);
}
return g_preview;
}
//##############################################################################################################################################################
// opt_index = 0, by the reason of zero-index in ConfigOptionVector by default (in case only one element)
void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt_key, const boost::any& value, int opt_index /*= 0*/)
{