Minor cleanups. NFC.
A few code style changes extracted from the Emscripten port.
This commit is contained in:
parent
7f75148671
commit
75a09c8b67
@ -77,6 +77,7 @@ set_target_properties(slvs PROPERTIES
|
|||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
install(TARGETS slvs
|
install(TARGETS slvs
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -203,6 +203,7 @@ Platform::KeyboardEvent GraphicsWindow::AcceleratorForCommand(Command cmd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Platform::KeyboardEvent accel = {};
|
Platform::KeyboardEvent accel = {};
|
||||||
|
accel.type = Platform::KeyboardEvent::Type::PRESS;
|
||||||
if(rawAccel & SHIFT_MASK) {
|
if(rawAccel & SHIFT_MASK) {
|
||||||
accel.shiftDown = true;
|
accel.shiftDown = true;
|
||||||
}
|
}
|
||||||
@ -395,12 +396,6 @@ void GraphicsWindow::Init() {
|
|||||||
if(!window) {
|
if(!window) {
|
||||||
window = Platform::CreateWindow();
|
window = Platform::CreateWindow();
|
||||||
if(window) {
|
if(window) {
|
||||||
canvas = CreateRenderer();
|
|
||||||
if(canvas) {
|
|
||||||
persistentCanvas = canvas->CreateBatch();
|
|
||||||
persistentDirty = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
using namespace std::placeholders;
|
using namespace std::placeholders;
|
||||||
window->onClose = std::bind(&SolveSpaceUI::MenuFile, Command::EXIT);
|
window->onClose = std::bind(&SolveSpaceUI::MenuFile, Command::EXIT);
|
||||||
window->onRender = std::bind(&GraphicsWindow::Paint, this);
|
window->onRender = std::bind(&GraphicsWindow::Paint, this);
|
||||||
@ -413,6 +408,14 @@ void GraphicsWindow::Init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(window) {
|
||||||
|
canvas = CreateRenderer();
|
||||||
|
if(canvas) {
|
||||||
|
persistentCanvas = canvas->CreateBatch();
|
||||||
|
persistentDirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Do this last, so that all the menus get updated correctly.
|
// Do this last, so that all the menus get updated correctly.
|
||||||
ClearSuper();
|
ClearSuper();
|
||||||
}
|
}
|
||||||
|
@ -85,8 +85,10 @@ struct KeyboardEvent {
|
|||||||
bool controlDown;
|
bool controlDown;
|
||||||
|
|
||||||
bool Equals(const KeyboardEvent &other) {
|
bool Equals(const KeyboardEvent &other) {
|
||||||
return type == other.type && key == other.key && num == other.num &&
|
return type == other.type && key == other.key &&
|
||||||
shiftDown == other.shiftDown && controlDown == other.controlDown;
|
shiftDown == other.shiftDown && controlDown == other.controlDown &&
|
||||||
|
((key == Key::CHARACTER && chr == other.chr) ||
|
||||||
|
(key == Key::FUNCTION && num == other.num));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -303,7 +305,7 @@ public:
|
|||||||
virtual void SetMessage(std::string message) = 0;
|
virtual void SetMessage(std::string message) = 0;
|
||||||
virtual void SetDescription(std::string description) = 0;
|
virtual void SetDescription(std::string description) = 0;
|
||||||
|
|
||||||
virtual void AddButton(std::string name, Response response, bool isDefault = false) = 0;
|
virtual void AddButton(std::string label, Response response, bool isDefault = false) = 0;
|
||||||
|
|
||||||
virtual Response RunModal() = 0;
|
virtual Response RunModal() = 0;
|
||||||
virtual void ShowModal() {
|
virtual void ShowModal() {
|
||||||
|
@ -1123,7 +1123,7 @@ public:
|
|||||||
gtkDialog.set_secondary_text(description);
|
gtkDialog.set_secondary_text(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddButton(std::string name, Response response, bool isDefault) override {
|
void AddButton(std::string label, Response response, bool isDefault) override {
|
||||||
int responseId = 0;
|
int responseId = 0;
|
||||||
switch(response) {
|
switch(response) {
|
||||||
case Response::NONE: ssassert(false, "Unexpected response");
|
case Response::NONE: ssassert(false, "Unexpected response");
|
||||||
@ -1132,7 +1132,7 @@ public:
|
|||||||
case Response::NO: responseId = Gtk::RESPONSE_NO; break;
|
case Response::NO: responseId = Gtk::RESPONSE_NO; break;
|
||||||
case Response::CANCEL: responseId = Gtk::RESPONSE_CANCEL; break;
|
case Response::CANCEL: responseId = Gtk::RESPONSE_CANCEL; break;
|
||||||
}
|
}
|
||||||
gtkDialog.add_button(PrepareMnemonics(name), responseId);
|
gtkDialog.add_button(PrepareMnemonics(label), responseId);
|
||||||
if(isDefault) {
|
if(isDefault) {
|
||||||
gtkDialog.set_default_response(responseId);
|
gtkDialog.set_default_response(responseId);
|
||||||
}
|
}
|
||||||
|
@ -1195,8 +1195,8 @@ public:
|
|||||||
nsAlert.informativeText = Wrap(description);
|
nsAlert.informativeText = Wrap(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddButton(std::string name, Response response, bool isDefault) override {
|
void AddButton(std::string label, Response response, bool isDefault) override {
|
||||||
NSButton *nsButton = [nsAlert addButtonWithTitle:Wrap(PrepareMnemonics(name))];
|
NSButton *nsButton = [nsAlert addButtonWithTitle:Wrap(PrepareMnemonics(label))];
|
||||||
if(!isDefault && [nsButton.keyEquivalent isEqualToString:@"\n"]) {
|
if(!isDefault && [nsButton.keyEquivalent isEqualToString:@"\n"]) {
|
||||||
nsButton.keyEquivalent = @"";
|
nsButton.keyEquivalent = @"";
|
||||||
} else if(response == Response::CANCEL) {
|
} else if(response == Response::CANCEL) {
|
||||||
|
@ -1428,7 +1428,7 @@ public:
|
|||||||
mbp.lpszText = textW.c_str();
|
mbp.lpszText = textW.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddButton(std::string _name, Response response, bool isDefault) override {
|
void AddButton(std::string _label, Response response, bool isDefault) override {
|
||||||
int button;
|
int button;
|
||||||
switch(response) {
|
switch(response) {
|
||||||
case Response::NONE: ssassert(false, "Invalid response");
|
case Response::NONE: ssassert(false, "Invalid response");
|
||||||
|
@ -15,16 +15,15 @@
|
|||||||
|
|
||||||
namespace SolveSpace {
|
namespace SolveSpace {
|
||||||
|
|
||||||
void dbp(const char *str, ...)
|
void dbp(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list f;
|
va_list va;
|
||||||
static char buf[1024*50];
|
va_start(va, fmt);
|
||||||
va_start(f, str);
|
vfprintf(stdout, fmt, va);
|
||||||
vsnprintf(buf, sizeof(buf), str, f);
|
fputc('\n', stdout);
|
||||||
va_end(f);
|
va_end(va);
|
||||||
|
|
||||||
fputs(buf, stderr);
|
fflush(stdout);
|
||||||
fputc('\n', stderr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
#ifndef SOLVESPACE_GL3SHADER_H
|
#ifndef SOLVESPACE_GL3SHADER_H
|
||||||
#define SOLVESPACE_GL3SHADER_H
|
#define SOLVESPACE_GL3SHADER_H
|
||||||
|
|
||||||
#ifdef WIN32
|
#if defined(WIN32)
|
||||||
# define GL_APICALL /*static linkage*/
|
# define GL_APICALL /*static linkage*/
|
||||||
# define GL_GLEXT_PROTOTYPES
|
# define GL_GLEXT_PROTOTYPES
|
||||||
# include <GLES2/gl2.h>
|
# include <GLES2/gl2.h>
|
||||||
# include <GLES2/gl2ext.h>
|
# include <GLES2/gl2ext.h>
|
||||||
# define HAVE_GLES
|
# define HAVE_GLES
|
||||||
#elif __APPLE__
|
#elif defined(__APPLE__)
|
||||||
# include <OpenGL/gl.h>
|
# include <OpenGL/gl.h>
|
||||||
#else
|
#else
|
||||||
# define GL_GLEXT_PROTOTYPES
|
# define GL_GLEXT_PROTOTYPES
|
||||||
|
Loading…
Reference in New Issue
Block a user