Start work on setting the controls in the main window.

This commit is contained in:
David Given
2022-02-21 00:57:39 +01:00
parent 6ca9f83bfe
commit c6cef191a7
6 changed files with 83 additions and 28 deletions

View File

@@ -564,9 +564,12 @@ buildlibrary libfrontend.a \
src/fluxengine.cc \
buildlibrary libgui.a \
-I$OBJDIR/proto \
-d $OBJDIR/proto/libconfig.def \
src/gui/main.cc \
src/gui/layout.cpp \
src/gui/visualisation.cc \
src/gui/mainwindow.cc \
buildprogram fluxengine \
libfrontend.a \
@@ -580,7 +583,13 @@ buildprogram fluxengine \
buildprogram fluxengine-gui \
-rule linkgui \
libgui.a
libgui.a \
libformats.a \
libbackend.a \
libconfig.a \
libfl2.a \
libusbp.a \
libfmt.a \
buildlibrary libemu.a \
dep/emu/fnmatch.c

View File

@@ -49,7 +49,7 @@ MainWindowGen::MainWindowGen( wxWindow* parent, wxWindowID id, const wxString& t
fgSizer3->SetFlexibleDirection( wxBOTH );
fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText4 = new wxStaticText( this, wxID_ANY, wxT("Device"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4 = new wxStaticText( this, wxID_ANY, wxT("Device:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4->Wrap( -1 );
fgSizer3->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5 );
@@ -58,7 +58,7 @@ MainWindowGen::MainWindowGen( wxWindow* parent, wxWindowID id, const wxString& t
deviceChoice->SetSelection( 0 );
fgSizer3->Add( deviceChoice, 0, wxALL|wxEXPAND, 5 );
m_staticText5 = new wxStaticText( this, wxID_ANY, wxT("Flux source/sink"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText5 = new wxStaticText( this, wxID_ANY, wxT("Flux source/sink:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText5->Wrap( -1 );
fgSizer3->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5 );
@@ -68,12 +68,12 @@ MainWindowGen::MainWindowGen( wxWindow* parent, wxWindowID id, const wxString& t
fluxSourceSinkChoice->SetSelection( 0 );
fgSizer3->Add( fluxSourceSinkChoice, 0, wxALL|wxEXPAND, 5 );
m_staticText51 = new wxStaticText( this, wxID_ANY, wxT("Format"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText51 = new wxStaticText( this, wxID_ANY, wxT("Format:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText51->Wrap( -1 );
fgSizer3->Add( m_staticText51, 0, wxALL, 5 );
fgSizer3->Add( m_staticText51, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5 );
wxArrayString formatChoiceChoices;
formatChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, formatChoiceChoices, 0 );
formatChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, formatChoiceChoices, wxCB_SORT );
formatChoice->SetSelection( 0 );
fgSizer3->Add( formatChoice, 0, wxALL|wxEXPAND, 5 );
@@ -83,14 +83,14 @@ MainWindowGen::MainWindowGen( wxWindow* parent, wxWindowID id, const wxString& t
highDensityToggle = new wxCheckBox( this, wxID_ANY, wxT("High density disk"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( highDensityToggle, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5 );
m_staticText7 = new wxStaticText( this, wxID_ANY, wxT("Cylinders"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7 = new wxStaticText( this, wxID_ANY, wxT("Cylinders:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7->Wrap( -1 );
fgSizer3->Add( m_staticText7, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5 );
cylindersText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( cylindersText, 0, wxALL|wxEXPAND, 5 );
m_staticText9 = new wxStaticText( this, wxID_ANY, wxT("Heads"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText9 = new wxStaticText( this, wxID_ANY, wxT("Heads:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText9->Wrap( -1 );
fgSizer3->Add( m_staticText9, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5 );

View File

@@ -281,7 +281,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Device</property>
<property name="label">Device:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -406,7 +406,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Flux source/sink</property>
<property name="label">Flux source/sink:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -501,7 +501,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@@ -531,7 +531,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Format</property>
<property name="label">Format:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -611,7 +611,7 @@
<property name="selection">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="style">wxCB_SORT</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
@@ -730,7 +730,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Cylinders</property>
<property name="label">Cylinders:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
@@ -855,7 +855,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Heads</property>
<property name="label">Heads:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>

View File

@@ -1,6 +1,6 @@
#include "globals.h"
#include <wx/wx.h>
#include "layout.h"
#include "mainwindow.h"
#include "gui.h"
class MyApp;
@@ -25,18 +25,6 @@ private:
};
wxDECLARE_APP(MyApp);
class MainWindow : public MainWindowGen
{
public:
MainWindow(): MainWindowGen(nullptr) {}
public:
void OnExit(wxCommandEvent& event)
{
Close(true);
}
};
wxDEFINE_EVENT(EXEC_EVENT_TYPE, ExecEvent);
class ExecEvent : public wxThreadEvent
{

36
src/gui/mainwindow.cc Normal file
View File

@@ -0,0 +1,36 @@
#include "globals.h"
#include "proto.h"
#include "gui.h"
#include "fmt/format.h"
#include <wx/wx.h>
#include "mainwindow.h"
extern const std::map<std::string, std::string> formats;
MainWindow::MainWindow(): MainWindowGen(nullptr)
{
for (const auto& it : formats)
{
auto config = std::make_unique<ConfigProto>();
if (!config->ParseFromString(it.second))
continue;
if (config->is_extension())
continue;
formatChoice->Append(it.first);
_formats[it.first] = std::move(config);
}
UpdateDevices();
}
void MainWindow::OnExit(wxCommandEvent& event)
{
Close(true);
}
void MainWindow::UpdateDevices()
{
//auto candidates = findUsbDevices({FLUXENGINE_ID, GREASEWEAZLE_ID});
}

22
src/gui/mainwindow.h Normal file
View File

@@ -0,0 +1,22 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "layout.h"
class ConfigProto;
class MainWindow : public MainWindowGen
{
public:
MainWindow();
private:
void OnExit(wxCommandEvent& event);
void UpdateDevices();
private:
std::map<std::string, std::unique_ptr<ConfigProto>> _formats;
};
#endif