Add a GTK2/3 port.
In principle, GTK3 is the way forward, and GTK2 is officially deprecated, though still maintained. In practice however, GTK3 is often unbearably buggy; e.g. on my system, combo boxes don't ever roll up in GTK3 windows. So I have added support for both. This required a few minor changes to the core, namely: * GTK wants to know beforehand whether a menu item is a check menu item or a regular one. * GTK doesn't give us an easy way to execute something after any event is processed, so an explicit idle timer is added. This is a no-op on Win32. * A few function signatures were const'ed, since GTK expects immutable strings when converting to Glib::ustring.pull/3/head
parent
b68631ee56
commit
2c39f259db
|
@ -1,2 +1,3 @@
|
|||
/CMakeCache.txt
|
||||
/cbuild/
|
||||
*.trace # OpenGL apitrace files
|
||||
|
|
|
@ -19,6 +19,10 @@ project(solvespace)
|
|||
set(solvespace_VERSION_MAJOR 2)
|
||||
set(solvespace_VERSION_MINOR 1)
|
||||
|
||||
if(NOT WIN32)
|
||||
set(GUI gtk2 CACHE STRING "GUI toolkit to use (one of: fltk gtk2 gtk3)")
|
||||
endif()
|
||||
|
||||
# compiler
|
||||
|
||||
if(WIN32)
|
||||
|
@ -68,8 +72,28 @@ else()
|
|||
find_package(PNG REQUIRED)
|
||||
find_package(SpaceWare)
|
||||
|
||||
if(GUI STREQUAL "fltk")
|
||||
# Find the packages the old-fashioned way. Doesn't require
|
||||
# the system to follow freedesktop standards.
|
||||
find_package(FLTK REQUIRED)
|
||||
CHECK_INCLUDE_FILE("fontconfig/fontconfig.h" HAVE_FONTCONFIG)
|
||||
elseif(GUI STREQUAL "gtk3" OR GUI STREQUAL "gtk2")
|
||||
# Use freedesktop's pkg-config to locate everything.
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(FONTCONFIG REQUIRED fontconfig)
|
||||
pkg_check_modules(JSONC REQUIRED json-c)
|
||||
|
||||
set(HAVE_GTK TRUE)
|
||||
if(GUI STREQUAL "gtk3")
|
||||
set(HAVE_GTK3 TRUE)
|
||||
pkg_check_modules(GTKMM REQUIRED gtkmm-3.0 pangomm-1.4 x11)
|
||||
else()
|
||||
set(HAVE_GTK2 TRUE)
|
||||
pkg_check_modules(GTKMM REQUIRED gtkmm-2.4 pangomm-1.4 x11)
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "GUI unrecognized: ${GUI}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# components
|
||||
|
|
|
@ -10,6 +10,14 @@ link_directories(
|
|||
add_definitions(
|
||||
${PNG_CFLAGS_OTHER})
|
||||
|
||||
link_directories(
|
||||
${PNG_LIBRARY_DIRS}
|
||||
${ZLIB_LIBRARY_DIRS})
|
||||
|
||||
add_definitions(
|
||||
${PNG_CFLAGS_OTHER}
|
||||
${ZLIB_CFLAGS_OTHER})
|
||||
|
||||
include_directories(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/built"
|
||||
|
@ -20,8 +28,9 @@ if(SPACEWARE_FOUND)
|
|||
"${SPACEWARE_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
set(HAVE_FLTK ${FLTK_FOUND})
|
||||
set(HAVE_SPACEWARE ${SPACEWARE_FOUND})
|
||||
set(HAVE_FLTK ${FLTK_FOUND})
|
||||
set(HAVE_GTK ${GTKMM_FOUND})
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/config.h")
|
||||
|
||||
|
@ -120,16 +129,38 @@ if(WIN32)
|
|||
win32/freeze.cpp
|
||||
win32/w32main.cpp
|
||||
win32/resource.rc)
|
||||
else()
|
||||
include_directories(
|
||||
"${FLTK_INCLUDE_DIR}")
|
||||
elseif(HAVE_FLTK)
|
||||
include_directories(${FLTK_INCLUDE_DIR})
|
||||
|
||||
set(platform_SOURCES
|
||||
fltk/fltkmain.cpp)
|
||||
|
||||
set(platform_LIBRARIES
|
||||
${CMAKE_DL_LIBS}
|
||||
"${FLTK_LIBRARIES}")
|
||||
${FLTK_LIBRARIES})
|
||||
elseif(HAVE_GTK)
|
||||
include_directories(
|
||||
${GTKMM_INCLUDE_DIRS}
|
||||
${JSONC_INCLUDE_DIRS}
|
||||
${FONTCONFIG_INCLUDE_DIRS})
|
||||
|
||||
link_directories(
|
||||
${GTKMM_LIBRARY_DIRS}
|
||||
${JSONC_LIBRARY_DIRS}
|
||||
${FONTCONFIG_LIBRARY_DIRS})
|
||||
|
||||
add_definitions(
|
||||
${GTKMM_CFLAGS_OTHER}
|
||||
${JSONC_CFLAGS_OTHER}
|
||||
${FONTCONFIG_CFLAGS_OTHER})
|
||||
|
||||
set(platform_SOURCES
|
||||
gtk/gtkmain.cpp)
|
||||
|
||||
set(platform_LIBRARIES
|
||||
${GTKMM_LIBRARIES}
|
||||
${JSONC_LIBRARIES}
|
||||
${FONTCONFIG_LIBRARIES})
|
||||
endif()
|
||||
|
||||
# solvespace executable
|
||||
|
|
|
@ -181,7 +181,7 @@ void GraphicsWindow::PasteClipboard(Vector trans, double theta, double scale) {
|
|||
}
|
||||
}
|
||||
|
||||
SS.later.generateAll = true;
|
||||
SS.ScheduleGenerateAll();
|
||||
}
|
||||
|
||||
void GraphicsWindow::MenuClipboard(int id) {
|
||||
|
@ -216,7 +216,7 @@ void GraphicsWindow::MenuClipboard(int id) {
|
|||
SS.TW.shown.paste.scale = 1;
|
||||
SS.TW.GoToScreen(TextWindow::SCREEN_PASTE_TRANSFORMED);
|
||||
SS.GW.ForceTextWindowShown();
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -360,7 +360,7 @@ void TextWindow::ScreenPasteTransformed(int link, uint32_t v) {
|
|||
SS.GW.PasteClipboard(t, theta, SS.TW.shown.paste.scale);
|
||||
}
|
||||
SS.TW.GoToScreen(SCREEN_LIST_OF_GROUPS);
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,23 @@
|
|||
|
||||
#define PACKAGE_VERSION "@solvespace_VERSION_MAJOR@.@solvespace_VERSION_MINOR@"
|
||||
|
||||
/* MSVC includes a proper stdint.h, but only since VS2008. */
|
||||
#cmakedefine HAVE_STDINT_H
|
||||
#cmakedefine HAVE_FONTCONFIG_FONTCONFIG_H
|
||||
|
||||
#cmakedefine HAVE_FLTK
|
||||
#define HAVE_FLTK_FULLSCREEN
|
||||
|
||||
/* Do we have the si library on win32, or libspnav on *nix? */
|
||||
#cmakedefine HAVE_SPACEWARE
|
||||
|
||||
#cmakedefine HAVE_GTK
|
||||
#cmakedefine HAVE_GTK2
|
||||
#cmakedefine HAVE_GTK3
|
||||
|
||||
#cmakedefine HAVE_FLTK
|
||||
|
||||
/* Only relevant for FLTK port. */
|
||||
#ifdef HAVE_FLTK
|
||||
#define HAVE_FLTK_FULLSCREEN
|
||||
#endif
|
||||
|
||||
#cmakedefine HAVE_FONTCONFIG
|
||||
|
||||
#endif
|
||||
|
|
|
@ -86,7 +86,7 @@ void Constraint::AddConstraint(Constraint *c, bool rememberForUndo) {
|
|||
SK.constraint.AddAndAssignId(c);
|
||||
|
||||
SS.MarkGroupDirty(c->group);
|
||||
SS.later.generateAll = true;
|
||||
SS.ScheduleGenerateAll();
|
||||
}
|
||||
|
||||
void Constraint::Constrain(int type, hEntity ptA, hEntity ptB,
|
||||
|
@ -515,7 +515,7 @@ void Constraint::MenuConstrain(int id) {
|
|||
SS.UndoRemember();
|
||||
c->other = !(c->other);
|
||||
SS.MarkGroupDirty(c->group);
|
||||
SS.later.generateAll = true;
|
||||
SS.ScheduleGenerateAll();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -699,7 +699,7 @@ void Constraint::MenuConstrain(int id) {
|
|||
case GraphicsWindow::MNU_COMMENT:
|
||||
SS.GW.pending.operation = GraphicsWindow::MNU_COMMENT;
|
||||
SS.GW.pending.description = "click center of comment text";
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
break;
|
||||
|
||||
default: oops();
|
||||
|
|
|
@ -37,8 +37,8 @@ void TextWindow::ScreenSetTtfFont(int link, uint32_t v) {
|
|||
SS.UndoRemember();
|
||||
r->font.strcpy(SS.fonts.l.elem[i].FontFileBaseName());
|
||||
SS.MarkGroupDirty(r->group);
|
||||
SS.later.generateAll = true;
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleGenerateAll();
|
||||
SS.ScheduleShowTW();
|
||||
}
|
||||
|
||||
void TextWindow::DescribeSelection(void) {
|
||||
|
|
|
@ -73,7 +73,7 @@ void GraphicsWindow::Selection::Draw(void) {
|
|||
|
||||
void GraphicsWindow::ClearSelection(void) {
|
||||
selection.Clear();
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
InvalidateGraphics();
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "solvespace.h"
|
||||
#include <png.h>
|
||||
|
||||
void SolveSpace::ExportSectionTo(char *filename) {
|
||||
void SolveSpace::ExportSectionTo(const char *filename) {
|
||||
Vector gn = (SS.GW.projRight).Cross(SS.GW.projUp);
|
||||
gn = gn.WithMagnitude(1);
|
||||
|
||||
|
@ -109,7 +109,7 @@ void SolveSpace::ExportSectionTo(char *filename) {
|
|||
bl.Clear();
|
||||
}
|
||||
|
||||
void SolveSpace::ExportViewOrWireframeTo(char *filename, bool wireframe) {
|
||||
void SolveSpace::ExportViewOrWireframeTo(const char *filename, bool wireframe) {
|
||||
int i;
|
||||
SEdgeList edges;
|
||||
ZERO(&edges);
|
||||
|
@ -403,7 +403,7 @@ double VectorFileWriter::MmToPts(double mm) {
|
|||
return (mm/25.4)*72;
|
||||
}
|
||||
|
||||
VectorFileWriter *VectorFileWriter::ForFile(char *filename) {
|
||||
VectorFileWriter *VectorFileWriter::ForFile(const char *filename) {
|
||||
VectorFileWriter *ret;
|
||||
if(StringEndsIn(filename, ".dxf")) {
|
||||
static DxfFileWriter DxfWriter;
|
||||
|
@ -573,7 +573,7 @@ void VectorFileWriter::BezierAsNonrationalCubic(SBezier *sb, int depth) {
|
|||
//-----------------------------------------------------------------------------
|
||||
// Export a triangle mesh, in the requested format.
|
||||
//-----------------------------------------------------------------------------
|
||||
void SolveSpace::ExportMeshTo(char *filename) {
|
||||
void SolveSpace::ExportMeshTo(const char *filename) {
|
||||
SMesh *m = &(SK.GetGroup(SS.GW.activeGroup)->displayMesh);
|
||||
if(m->IsEmpty()) {
|
||||
Error("Active group mesh is empty; nothing to export.");
|
||||
|
@ -673,7 +673,7 @@ void SolveSpace::ExportMeshAsObjTo(FILE *f, SMesh *sm) {
|
|||
// Export a view of the model as an image; we just take a screenshot, by
|
||||
// rendering the view in the usual way and then copying the pixels.
|
||||
//-----------------------------------------------------------------------------
|
||||
void SolveSpace::ExportAsPngTo(char *filename) {
|
||||
void SolveSpace::ExportAsPngTo(const char *filename) {
|
||||
int w = (int)SS.GW.width, h = (int)SS.GW.height;
|
||||
// No guarantee that the back buffer contains anything valid right now,
|
||||
// so repaint the scene. And hide the toolbar too.
|
||||
|
|
|
@ -253,11 +253,11 @@ void SolveSpace::SaveUsingTable(int type) {
|
|||
}
|
||||
}
|
||||
|
||||
bool SolveSpace::SaveToFile(char *filename) {
|
||||
bool SolveSpace::SaveToFile(const char *filename) {
|
||||
// Make sure all the entities are regenerated up to date, since they
|
||||
// will be exported. We reload the imported files because that rewrites
|
||||
// the impFileRel for our possibly-new filename.
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
SS.ReloadAllImported();
|
||||
SS.GenerateAll(0, INT_MAX);
|
||||
|
||||
|
@ -423,7 +423,7 @@ void SolveSpace::LoadUsingTable(char *key, char *val) {
|
|||
}
|
||||
}
|
||||
|
||||
bool SolveSpace::LoadFromFile(char *filename) {
|
||||
bool SolveSpace::LoadFromFile(const char *filename) {
|
||||
allConsistent = false;
|
||||
fileLoadError = false;
|
||||
|
||||
|
@ -506,7 +506,7 @@ bool SolveSpace::LoadFromFile(char *filename) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool SolveSpace::LoadEntitiesFromFile(char *file, EntityList *le,
|
||||
bool SolveSpace::LoadEntitiesFromFile(const char *file, EntityList *le,
|
||||
SMesh *m, SShell *sh)
|
||||
{
|
||||
SSurface srf;
|
||||
|
|
|
@ -169,6 +169,10 @@ void SetTimerFor(int milliseconds)
|
|||
Fl::add_timeout((double)milliseconds / 1000.0, TimerCallback);
|
||||
}
|
||||
|
||||
void ScheduleLater()
|
||||
{
|
||||
}
|
||||
|
||||
void OpenWebsite(const char *url)
|
||||
{
|
||||
fl_open_uri(url, NULL, 0);
|
||||
|
@ -356,13 +360,6 @@ int64_t GetMilliseconds(void)
|
|||
return 1000 * (int64_t)sec + (int64_t)usec / 1000;
|
||||
}
|
||||
|
||||
int64_t GetUnixTime(void)
|
||||
{
|
||||
time_t ret;
|
||||
time(&ret);
|
||||
return (int64_t)ret;
|
||||
}
|
||||
|
||||
class Graphics_Gl_Window : public Fl_Gl_Window
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -311,7 +311,7 @@ void SolveSpace::GenerateAll(int first, int last, bool andFindFree) {
|
|||
if(deleted.groups > 0) {
|
||||
SS.TW.ClearSuper();
|
||||
}
|
||||
later.showTW = true;
|
||||
ScheduleShowTW();
|
||||
GW.ClearSuper();
|
||||
|
||||
// People get annoyed if I complain whenever they delete any request,
|
||||
|
|
|
@ -20,143 +20,146 @@
|
|||
#define S SHIFT_MASK
|
||||
#define C CTRL_MASK
|
||||
#define F(k) (FUNCTION_KEY_BASE+(k))
|
||||
#define IN MENU_ITEM_NORMAL
|
||||
#define IC MENU_ITEM_CHECK
|
||||
#define IR MENU_ITEM_RADIO
|
||||
const GraphicsWindow::MenuEntry GraphicsWindow::menu[] = {
|
||||
//level
|
||||
// label id accel fn
|
||||
{ 0, "&File", 0, 0, NULL },
|
||||
{ 1, "&New", MNU_NEW, C|'N', mFile },
|
||||
{ 1, "&Open...", MNU_OPEN, C|'O', mFile },
|
||||
{ 1, "Open &Recent", MNU_OPEN_RECENT, 0, mFile },
|
||||
{ 1, "&Save", MNU_SAVE, C|'S', mFile },
|
||||
{ 1, "Save &As...", MNU_SAVE_AS, 0, mFile },
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "Export &Image...", MNU_EXPORT_PNG, 0, mFile },
|
||||
{ 1, "Export 2d &View...", MNU_EXPORT_VIEW, 0, mFile },
|
||||
{ 1, "Export 2d &Section...", MNU_EXPORT_SECTION, 0, mFile },
|
||||
{ 1, "Export 3d &Wireframe...", MNU_EXPORT_WIREFRAME, 0, mFile },
|
||||
{ 1, "Export Triangle &Mesh...", MNU_EXPORT_MESH, 0, mFile },
|
||||
{ 1, "Export &Surfaces...", MNU_EXPORT_SURFACES,0, mFile },
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "E&xit", MNU_EXIT, C|'Q', mFile },
|
||||
// label id accel ty fn
|
||||
{ 0, "&File", 0, 0, IN, NULL },
|
||||
{ 1, "&New", MNU_NEW, C|'N', IN, mFile },
|
||||
{ 1, "&Open...", MNU_OPEN, C|'O', IN, mFile },
|
||||
{ 1, "Open &Recent", MNU_OPEN_RECENT, 0, IN, mFile },
|
||||
{ 1, "&Save", MNU_SAVE, C|'S', IN, mFile },
|
||||
{ 1, "Save &As...", MNU_SAVE_AS, 0, IN, mFile },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "Export &Image...", MNU_EXPORT_PNG, 0, IN, mFile },
|
||||
{ 1, "Export 2d &View...", MNU_EXPORT_VIEW, 0, IN, mFile },
|
||||
{ 1, "Export 2d &Section...", MNU_EXPORT_SECTION, 0, IN, mFile },
|
||||
{ 1, "Export 3d &Wireframe...", MNU_EXPORT_WIREFRAME, 0, IN, mFile },
|
||||
{ 1, "Export Triangle &Mesh...", MNU_EXPORT_MESH, 0, IN, mFile },
|
||||
{ 1, "Export &Surfaces...", MNU_EXPORT_SURFACES,0, IN, mFile },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "E&xit", MNU_EXIT, C|'Q', IN, mFile },
|
||||
|
||||
{ 0, "&Edit", 0, 0, NULL },
|
||||
{ 1, "&Undo", MNU_UNDO, C|'Z', mEdit },
|
||||
{ 1, "&Redo", MNU_REDO, C|'Y', mEdit },
|
||||
{ 1, "Re&generate All", MNU_REGEN_ALL, ' ', mEdit },
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "Snap Selection to &Grid", MNU_SNAP_TO_GRID, '.', mEdit },
|
||||
{ 0, "&Edit", 0, 0, IN, NULL },
|
||||
{ 1, "&Undo", MNU_UNDO, C|'Z', IN, mEdit },
|
||||
{ 1, "&Redo", MNU_REDO, C|'Y', IN, mEdit },
|
||||
{ 1, "Re&generate All", MNU_REGEN_ALL, ' ', IN, mEdit },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "Snap Selection to &Grid", MNU_SNAP_TO_GRID, '.', IN, mEdit },
|
||||
#ifdef WIN32
|
||||
{ 1, "Rotate Imported &90\260", MNU_ROTATE_90, '9', mEdit },
|
||||
{ 1, "Rotate Imported &90\260", MNU_ROTATE_90, '9', IN, mEdit },
|
||||
#else
|
||||
{ 1, "Rotate Imported &90°", MNU_ROTATE_90, '9', mEdit },
|
||||
{ 1, "Rotate Imported &90°", MNU_ROTATE_90, '9', IN, mEdit },
|
||||
#endif
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "Cu&t", MNU_CUT, C|'X', mClip },
|
||||
{ 1, "&Copy", MNU_COPY, C|'C', mClip },
|
||||
{ 1, "&Paste", MNU_PASTE, C|'V', mClip },
|
||||
{ 1, "Paste &Transformed...", MNU_PASTE_TRANSFORM,C|'T', mClip },
|
||||
{ 1, "&Delete", MNU_DELETE, DEL, mClip },
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "Select &Edge Chain", MNU_SELECT_CHAIN, C|'E', mEdit },
|
||||
{ 1, "Select &All", MNU_SELECT_ALL, C|'A', mEdit },
|
||||
{ 1, "&Unselect All", MNU_UNSELECT_ALL, ESC, mEdit },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "Cu&t", MNU_CUT, C|'X', IN, mClip },
|
||||
{ 1, "&Copy", MNU_COPY, C|'C', IN, mClip },
|
||||
{ 1, "&Paste", MNU_PASTE, C|'V', IN, mClip },
|
||||
{ 1, "Paste &Transformed...", MNU_PASTE_TRANSFORM,C|'T', IN, mClip },
|
||||
{ 1, "&Delete", MNU_DELETE, DEL, IN, mClip },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "Select &Edge Chain", MNU_SELECT_CHAIN, C|'E', IN, mEdit },
|
||||
{ 1, "Select &All", MNU_SELECT_ALL, C|'A', IN, mEdit },
|
||||
{ 1, "&Unselect All", MNU_UNSELECT_ALL, ESC, IN, mEdit },
|
||||
|
||||
{ 0, "&View", 0, 0, NULL },
|
||||
{ 1, "Zoom &In", MNU_ZOOM_IN, '+', mView },
|
||||
{ 1, "Zoom &Out", MNU_ZOOM_OUT, '-', mView },
|
||||
{ 1, "Zoom To &Fit", MNU_ZOOM_TO_FIT, 'F', mView },
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "Align View to &Workplane", MNU_ONTO_WORKPLANE, 'W', mView },
|
||||
{ 1, "Nearest &Ortho View", MNU_NEAREST_ORTHO, F(2), mView },
|
||||
{ 1, "Nearest &Isometric View", MNU_NEAREST_ISO, F(3), mView },
|
||||
{ 1, "&Center View At Point", MNU_CENTER_VIEW, F(4), mView },
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "Show Snap &Grid", MNU_SHOW_GRID, '>', mView },
|
||||
{ 1, "Use &Perspective Projection", MNU_PERSPECTIVE_PROJ,'`', mView },
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
#ifdef HAVE_FLTK
|
||||
{ 1, "Show Menu &Bar", MNU_SHOW_MENU_BAR, F(12), mView },
|
||||
{ 0, "&View", 0, 0, IN, NULL },
|
||||
{ 1, "Zoom &In", MNU_ZOOM_IN, '+', IN, mView },
|
||||
{ 1, "Zoom &Out", MNU_ZOOM_OUT, '-', IN, mView },
|
||||
{ 1, "Zoom To &Fit", MNU_ZOOM_TO_FIT, 'F', IN, mView },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "Align View to &Workplane", MNU_ONTO_WORKPLANE, 'W', IN, mView },
|
||||
{ 1, "Nearest &Ortho View", MNU_NEAREST_ORTHO, F(2), IN, mView },
|
||||
{ 1, "Nearest &Isometric View", MNU_NEAREST_ISO, F(3), IN, mView },
|
||||
{ 1, "&Center View At Point", MNU_CENTER_VIEW, F(4), IN, mView },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "Show Snap &Grid", MNU_SHOW_GRID, '>', IC, mView },
|
||||
{ 1, "Use &Perspective Projection", MNU_PERSPECTIVE_PROJ,'`', IC, mView },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
#if defined(HAVE_FLTK)
|
||||
{ 1, "Show Menu &Bar", MNU_SHOW_MENU_BAR, F(12), IC, mView },
|
||||
#endif
|
||||
{ 1, "Show &Toolbar", MNU_SHOW_TOOLBAR, 0, mView },
|
||||
{ 1, "Show Text &Window", MNU_SHOW_TEXT_WND, '\t', mView },
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "Dimensions in &Inches", MNU_UNITS_INCHES, 0, mView },
|
||||
{ 1, "Dimensions in &Millimeters", MNU_UNITS_MM, 0, mView },
|
||||
#ifdef HAVE_FLTK_FULLSCREEN
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "&Full Screen", MNU_FULL_SCREEN, F(11), mView },
|
||||
{ 1, "Show &Toolbar", MNU_SHOW_TOOLBAR, 0, IC, mView },
|
||||
{ 1, "Show Text &Window", MNU_SHOW_TEXT_WND, '\t', IC, mView },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "Dimensions in &Inches", MNU_UNITS_INCHES, 0, IR, mView },
|
||||
{ 1, "Dimensions in &Millimeters", MNU_UNITS_MM, 0, IR, mView },
|
||||
#if defined(HAVE_FLTK_FULLSCREEN) || defined(HAVE_GTK)
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "&Full Screen", MNU_FULL_SCREEN, F(11), IC, mView },
|
||||
#endif
|
||||
|
||||
{ 0, "&New Group", 0, 0, NULL },
|
||||
{ 1, "Sketch In &3d", MNU_GROUP_3D, S|'3', mGrp },
|
||||
{ 1, "Sketch In New &Workplane", MNU_GROUP_WRKPL, S|'W', mGrp },
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "Step &Translating", MNU_GROUP_TRANS, S|'T', mGrp },
|
||||
{ 1, "Step &Rotating", MNU_GROUP_ROT, S|'R', mGrp },
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "E&xtrude", MNU_GROUP_EXTRUDE, S|'X', mGrp },
|
||||
{ 1, "&Lathe", MNU_GROUP_LATHE, S|'L', mGrp },
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "Import / Assemble...", MNU_GROUP_IMPORT, S|'I', mGrp },
|
||||
{ 1, "Import Recent", MNU_GROUP_RECENT, 0, mGrp },
|
||||
{ 0, "&New Group", 0, 0, IN, NULL },
|
||||
{ 1, "Sketch In &3d", MNU_GROUP_3D, S|'3', IN, mGrp },
|
||||
{ 1, "Sketch In New &Workplane", MNU_GROUP_WRKPL, S|'W', IN, mGrp },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "Step &Translating", MNU_GROUP_TRANS, S|'T', IN, mGrp },
|
||||
{ 1, "Step &Rotating", MNU_GROUP_ROT, S|'R', IN, mGrp },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "E&xtrude", MNU_GROUP_EXTRUDE, S|'X', IN, mGrp },
|
||||
{ 1, "&Lathe", MNU_GROUP_LATHE, S|'L', IN, mGrp },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "Import / Assemble...", MNU_GROUP_IMPORT, S|'I', IN, mGrp },
|
||||
{ 1, "Import Recent", MNU_GROUP_RECENT, 0, IN, mGrp },
|
||||
|
||||
{ 0, "&Sketch", 0, 0, NULL },
|
||||
{ 1, "In &Workplane", MNU_SEL_WORKPLANE, '2', mReq },
|
||||
{ 1, "Anywhere In &3d", MNU_FREE_IN_3D, '3', mReq },
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "Datum &Point", MNU_DATUM_POINT, 'P', mReq },
|
||||
{ 1, "&Workplane", MNU_WORKPLANE, 0, mReq },
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "Line &Segment", MNU_LINE_SEGMENT, 'S', mReq },
|
||||
{ 1, "&Rectangle", MNU_RECTANGLE, 'R', mReq },
|
||||
{ 1, "&Circle", MNU_CIRCLE, 'C', mReq },
|
||||
{ 1, "&Arc of a Circle", MNU_ARC, 'A', mReq },
|
||||
{ 1, "&Bezier Cubic Spline", MNU_CUBIC, 'B', mReq },
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "&Text in TrueType Font", MNU_TTF_TEXT, 'T', mReq },
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "To&ggle Construction", MNU_CONSTRUCTION, 'G', mReq },
|
||||
{ 1, "Tangent &Arc at Point", MNU_TANGENT_ARC, S|'A', mReq },
|
||||
{ 1, "Split Curves at &Intersection", MNU_SPLIT_CURVES, 'I', mReq },
|
||||
{ 0, "&Sketch", 0, 0, IN, NULL },
|
||||
{ 1, "In &Workplane", MNU_SEL_WORKPLANE, '2', IR, mReq },
|
||||
{ 1, "Anywhere In &3d", MNU_FREE_IN_3D, '3', IR, mReq },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "Datum &Point", MNU_DATUM_POINT, 'P', IN, mReq },
|
||||
{ 1, "&Workplane", MNU_WORKPLANE, 0, IN, mReq },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "Line &Segment", MNU_LINE_SEGMENT, 'S', IN, mReq },
|
||||
{ 1, "&Rectangle", MNU_RECTANGLE, 'R', IN, mReq },
|
||||
{ 1, "&Circle", MNU_CIRCLE, 'C', IN, mReq },
|
||||
{ 1, "&Arc of a Circle", MNU_ARC, 'A', IN, mReq },
|
||||
{ 1, "&Bezier Cubic Spline", MNU_CUBIC, 'B', IN, mReq },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "&Text in TrueType Font", MNU_TTF_TEXT, 'T', IN, mReq },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "To&ggle Construction", MNU_CONSTRUCTION, 'G', IN, mReq },
|
||||
{ 1, "Tangent &Arc at Point", MNU_TANGENT_ARC, S|'A', IN, mReq },
|
||||
{ 1, "Split Curves at &Intersection", MNU_SPLIT_CURVES, 'I', IN, mReq },
|
||||
|
||||
{ 0, "&Constrain", 0, 0, NULL },
|
||||
{ 1, "&Distance / Diameter", MNU_DISTANCE_DIA, 'D', mCon },
|
||||
{ 1, "A&ngle", MNU_ANGLE, 'N', mCon },
|
||||
{ 1, "Other S&upplementary Angle", MNU_OTHER_ANGLE, 'U', mCon },
|
||||
{ 1, "Toggle R&eference Dim", MNU_REFERENCE, 'E', mCon },
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "&Horizontal", MNU_HORIZONTAL, 'H', mCon },
|
||||
{ 1, "&Vertical", MNU_VERTICAL, 'V', mCon },
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "&On Point / Curve / Plane", MNU_ON_ENTITY, 'O', mCon },
|
||||
{ 1, "E&qual Length / Radius / Angle", MNU_EQUAL, 'Q', mCon },
|
||||
{ 1, "Length Ra&tio", MNU_RATIO, 'Z', mCon },
|
||||
{ 1, "At &Midpoint", MNU_AT_MIDPOINT, 'M', mCon },
|
||||
{ 1, "S&ymmetric", MNU_SYMMETRIC, 'Y', mCon },
|
||||
{ 1, "Para&llel / Tangent", MNU_PARALLEL, 'L', mCon },
|
||||
{ 1, "&Perpendicular", MNU_PERPENDICULAR, '[', mCon },
|
||||
{ 1, "Same Orient&ation", MNU_ORIENTED_SAME, 'X', mCon },
|
||||
{ 1, "Lock Point Where &Dragged", MNU_WHERE_DRAGGED, ']', mCon },
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "Comment", MNU_COMMENT, ';', mCon },
|
||||
{ 0, "&Constrain", 0, 0, IN, NULL },
|
||||
{ 1, "&Distance / Diameter", MNU_DISTANCE_DIA, 'D', IN, mCon },
|
||||
{ 1, "A&ngle", MNU_ANGLE, 'N', IN, mCon },
|
||||
{ 1, "Other S&upplementary Angle", MNU_OTHER_ANGLE, 'U', IN, mCon },
|
||||
{ 1, "Toggle R&eference Dim", MNU_REFERENCE, 'E', IN, mCon },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "&Horizontal", MNU_HORIZONTAL, 'H', IN, mCon },
|
||||
{ 1, "&Vertical", MNU_VERTICAL, 'V', IN, mCon },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "&On Point / Curve / Plane", MNU_ON_ENTITY, 'O', IN, mCon },
|
||||
{ 1, "E&qual Length / Radius / Angle", MNU_EQUAL, 'Q', IN, mCon },
|
||||
{ 1, "Length Ra&tio", MNU_RATIO, 'Z', IN, mCon },
|
||||
{ 1, "At &Midpoint", MNU_AT_MIDPOINT, 'M', IN, mCon },
|
||||
{ 1, "S&ymmetric", MNU_SYMMETRIC, 'Y', IN, mCon },
|
||||
{ 1, "Para&llel / Tangent", MNU_PARALLEL, 'L', IN, mCon },
|
||||
{ 1, "&Perpendicular", MNU_PERPENDICULAR, '[', IN, mCon },
|
||||
{ 1, "Same Orient&ation", MNU_ORIENTED_SAME, 'X', IN, mCon },
|
||||
{ 1, "Lock Point Where &Dragged", MNU_WHERE_DRAGGED, ']', IN, mCon },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "Comment", MNU_COMMENT, ';', IN, mCon },
|
||||
|
||||
{ 0, "&Analyze", 0, 0, NULL },
|
||||
{ 1, "Measure &Volume", MNU_VOLUME, C|S|'V',mAna },
|
||||
{ 1, "Measure &Area", MNU_AREA, C|S|'A',mAna },
|
||||
{ 1, "Show &Interfering Parts", MNU_INTERFERENCE, C|S|'I',mAna },
|
||||
{ 1, "Show &Naked Edges", MNU_NAKED_EDGES, C|S|'N',mAna },
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "Show Degrees of &Freedom", MNU_SHOW_DOF, C|S|'F',mAna },
|
||||
{ 1, NULL, 0, 0, NULL },
|
||||
{ 1, "&Trace Point", MNU_TRACE_PT, C|S|'T',mAna },
|
||||
{ 1, "&Stop Tracing...", MNU_STOP_TRACING, C|S|'S',mAna },
|
||||
{ 1, "Step &Dimension...", MNU_STEP_DIM, C|S|'D',mAna },
|
||||
{ 0, "&Analyze", 0, 0, IN, NULL },
|
||||
{ 1, "Measure &Volume", MNU_VOLUME, C|S|'V', IN, mAna },
|
||||
{ 1, "Measure &Area", MNU_AREA, C|S|'A', IN, mAna },
|
||||
{ 1, "Show &Interfering Parts", MNU_INTERFERENCE, C|S|'I', IN, mAna },
|
||||
{ 1, "Show &Naked Edges", MNU_NAKED_EDGES, C|S|'N', IN, mAna },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "Show Degrees of &Freedom", MNU_SHOW_DOF, C|S|'F', IN, mAna },
|
||||
{ 1, NULL, 0, 0, IN, NULL },
|
||||
{ 1, "&Trace Point", MNU_TRACE_PT, C|S|'T', IN, mAna },
|
||||
{ 1, "&Stop Tracing...", MNU_STOP_TRACING, C|S|'S', IN, mAna },
|
||||
{ 1, "Step &Dimension...", MNU_STEP_DIM, C|S|'D', IN, mAna },
|
||||
|
||||
{ 0, "&Help", 0, 0, NULL },
|
||||
{ 1, "&Website / Manual", MNU_WEBSITE, 0, mHelp },
|
||||
{ 1, "&About", MNU_ABOUT, 0, mHelp },
|
||||
{ 0, "&Help", 0, 0, IN, NULL },
|
||||
{ 1, "&Website / Manual", MNU_WEBSITE, 0, IN, mHelp },
|
||||
{ 1, "&About", MNU_ABOUT, 0, IN, mHelp },
|
||||
|
||||
{ -1, 0, 0, 0, 0 }
|
||||
{ -1, 0, 0, 0, IN, 0 }
|
||||
};
|
||||
|
||||
#undef DEL
|
||||
|
@ -164,6 +167,9 @@ const GraphicsWindow::MenuEntry GraphicsWindow::menu[] = {
|
|||
#undef S
|
||||
#undef C
|
||||
#undef F
|
||||
#undef IN
|
||||
#undef IC
|
||||
#undef IR
|
||||
|
||||
bool MakeAcceleratorLabel(int accel, char *out) {
|
||||
if(!accel) {
|
||||
|
@ -288,7 +294,7 @@ void GraphicsWindow::AnimateOnto(Quaternion quatf, Vector offsetf) {
|
|||
offset = offsetf;
|
||||
InvalidateGraphics();
|
||||
// If the view screen is open, then we need to refresh it.
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
}
|
||||
|
||||
void GraphicsWindow::HandlePointForZoomToFit(Vector p,
|
||||
|
@ -399,17 +405,17 @@ void GraphicsWindow::MenuView(int id) {
|
|||
switch(id) {
|
||||
case MNU_ZOOM_IN:
|
||||
SS.GW.scale *= 1.2;
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
break;
|
||||
|
||||
case MNU_ZOOM_OUT:
|
||||
SS.GW.scale /= 1.2;
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
break;
|
||||
|
||||
case MNU_ZOOM_TO_FIT:
|
||||
SS.GW.ZoomToFit(false);
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
break;
|
||||
|
||||
case MNU_SHOW_GRID:
|
||||
|
@ -442,7 +448,7 @@ void GraphicsWindow::MenuView(int id) {
|
|||
}
|
||||
SS.GW.AnimateOntoWorkplane();
|
||||
SS.GW.ClearSuper();
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
break;
|
||||
|
||||
case MNU_NEAREST_ORTHO:
|
||||
|
@ -534,13 +540,13 @@ void GraphicsWindow::MenuView(int id) {
|
|||
|
||||
case MNU_UNITS_INCHES:
|
||||
SS.viewUnits = SolveSpace::UNIT_INCHES;
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
SS.GW.EnsureValidActives();
|
||||
break;
|
||||
|
||||
case MNU_UNITS_MM:
|
||||
SS.viewUnits = SolveSpace::UNIT_MM;
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
SS.GW.EnsureValidActives();
|
||||
break;
|
||||
|
||||
|
@ -618,17 +624,17 @@ void GraphicsWindow::EnsureValidActives(void) {
|
|||
ShowTextWindow(SS.GW.showTextWindow);
|
||||
CheckMenuById(MNU_SHOW_TEXT_WND, SS.GW.showTextWindow);
|
||||
|
||||
#ifdef HAVE_FLTK
|
||||
#if defined(HAVE_FLTK)
|
||||
CheckMenuById(MNU_SHOW_MENU_BAR, MenuBarIsVisible());
|
||||
#endif
|
||||
CheckMenuById(MNU_SHOW_TOOLBAR, SS.showToolbar);
|
||||
CheckMenuById(MNU_PERSPECTIVE_PROJ, SS.usePerspectiveProj);
|
||||
CheckMenuById(MNU_SHOW_GRID, SS.GW.showSnapGrid);
|
||||
#ifdef HAVE_FLTK_FULLSCREEN
|
||||
#if defined(HAVE_FLTK_FULLSCREEN) || defined(HAVE_GTK)
|
||||
CheckMenuById(MNU_FULL_SCREEN, FullScreenIsActive());
|
||||
#endif
|
||||
|
||||
if(change) SS.later.showTW = true;
|
||||
if(change) SS.ScheduleShowTW();
|
||||
}
|
||||
|
||||
void GraphicsWindow::SetWorkplaneFreeIn3d(void) {
|
||||
|
@ -675,7 +681,7 @@ void GraphicsWindow::DeleteTaggedRequests(void) {
|
|||
// that references it (since the regen code checks for that).
|
||||
SS.GenerateAll(0, INT_MAX);
|
||||
EnsureValidActives();
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
}
|
||||
|
||||
Vector GraphicsWindow::SnapToGrid(Vector p) {
|
||||
|
@ -739,7 +745,7 @@ void GraphicsWindow::MenuEdit(int id) {
|
|||
SS.GW.MakeSelected(e->h);
|
||||
}
|
||||
InvalidateGraphics();
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -789,7 +795,7 @@ void GraphicsWindow::MenuEdit(int id) {
|
|||
"selected entities.");
|
||||
}
|
||||
InvalidateGraphics();
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -882,7 +888,7 @@ void GraphicsWindow::MenuEdit(int id) {
|
|||
case MNU_REGEN_ALL:
|
||||
SS.ReloadAllImported();
|
||||
SS.GenerateAll(0, INT_MAX);
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
break;
|
||||
|
||||
default: oops();
|
||||
|
@ -916,13 +922,13 @@ void GraphicsWindow::MenuRequest(int id) {
|
|||
// Align the view with the selected workplane
|
||||
SS.GW.AnimateOntoWorkplane();
|
||||
SS.GW.ClearSuper();
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
break;
|
||||
}
|
||||
case MNU_FREE_IN_3D:
|
||||
SS.GW.SetWorkplaneFreeIn3d();
|
||||
SS.GW.EnsureValidActives();
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
InvalidateGraphics();
|
||||
break;
|
||||
|
||||
|
@ -937,7 +943,7 @@ void GraphicsWindow::MenuRequest(int id) {
|
|||
} else {
|
||||
SS.TW.GoToScreen(TextWindow::SCREEN_TANGENT_ARC);
|
||||
SS.GW.ForceTextWindowShown();
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -952,7 +958,7 @@ void GraphicsWindow::MenuRequest(int id) {
|
|||
c:
|
||||
SS.GW.pending.operation = id;
|
||||
SS.GW.pending.description = s;
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
break;
|
||||
|
||||
case MNU_CONSTRUCTION: {
|
||||
|
@ -1004,6 +1010,6 @@ void GraphicsWindow::ToggleBool(bool *v) {
|
|||
|
||||
SS.GenerateAll();
|
||||
InvalidateGraphics();
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
}
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ void Group::MenuGroup(int id) {
|
|||
gg->Activate();
|
||||
SS.GW.AnimateOntoWorkplane();
|
||||
TextWindow::ScreenSelectGroup(0, gg->h.v);
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
}
|
||||
|
||||
void Group::TransformImportedBy(Vector t, Quaternion q) {
|
||||
|
@ -291,8 +291,8 @@ void Group::Activate(void) {
|
|||
SS.GW.showFaces = false;
|
||||
}
|
||||
SS.MarkGroupDirty(h); // for good measure; shouldn't be needed
|
||||
SS.later.generateAll = true;
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleGenerateAll();
|
||||
SS.ScheduleShowTW();
|
||||
}
|
||||
|
||||
void Group::Generate(IdList<Entity,hEntity> *entity,
|
||||
|
|
|
@ -330,7 +330,7 @@ void Group::GenerateShellAndMesh(void) {
|
|||
// for this group.
|
||||
booleanFailed = runningShell.booleanFailed;
|
||||
if(booleanFailed != prevBooleanFailed) {
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
}
|
||||
} else {
|
||||
SMesh prevm, thism;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -403,7 +403,7 @@ void GraphicsWindow::MakeTangentArc(void) {
|
|||
DeleteTaggedRequests();
|
||||
}
|
||||
|
||||
SS.later.generateAll = true;
|
||||
SS.ScheduleGenerateAll();
|
||||
}
|
||||
|
||||
hEntity GraphicsWindow::SplitLine(hEntity he, Vector pinter) {
|
||||
|
@ -647,6 +647,6 @@ void GraphicsWindow::SplitLinesOrCurves(void) {
|
|||
sbla.Clear();
|
||||
sblb.Clear();
|
||||
ClearSelection();
|
||||
SS.later.generateAll = true;
|
||||
SS.ScheduleGenerateAll();
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ void GraphicsWindow::MouseMoved(double x, double y, bool leftDown,
|
|||
|
||||
if(SS.TW.shown.screen == TextWindow::SCREEN_EDIT_VIEW) {
|
||||
if(havePainted) {
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
}
|
||||
}
|
||||
InvalidateGraphics();
|
||||
|
@ -455,7 +455,7 @@ void GraphicsWindow::MouseMoved(double x, double y, bool leftDown,
|
|||
void GraphicsWindow::ClearPending(void) {
|
||||
pending.points.Clear();
|
||||
ZERO(&pending);
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
}
|
||||
|
||||
void GraphicsWindow::MouseMiddleOrRightDown(double x, double y) {
|
||||
|
@ -511,7 +511,7 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
|
|||
|
||||
if(!hover.IsEmpty()) {
|
||||
MakeSelected(&hover);
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
}
|
||||
GroupSelection();
|
||||
|
||||
|
@ -664,7 +664,7 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
|
|||
|
||||
SS.TW.GoToScreen(TextWindow::SCREEN_GROUP_INFO);
|
||||
SS.TW.shown.group = hg;
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -684,7 +684,7 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
|
|||
|
||||
SS.TW.GoToScreen(TextWindow::SCREEN_STYLE_INFO);
|
||||
SS.TW.shown.style = hs;
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -709,7 +709,7 @@ void GraphicsWindow::MouseRightUp(double x, double y) {
|
|||
}
|
||||
|
||||
context.active = false;
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
}
|
||||
|
||||
hRequest GraphicsWindow::AddRequest(int type) {
|
||||
|
@ -979,7 +979,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
|
|||
r->extraPoints -= 2;
|
||||
// And we're done.
|
||||
SS.MarkGroupDirty(r->group);
|
||||
SS.later.generateAll = true;
|
||||
SS.ScheduleGenerateAll();
|
||||
ClearPending();
|
||||
break;
|
||||
}
|
||||
|
@ -1060,7 +1060,7 @@ void GraphicsWindow::MouseLeftDown(double mx, double my) {
|
|||
break;
|
||||
}
|
||||
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
InvalidateGraphics();
|
||||
}
|
||||
|
||||
|
@ -1227,9 +1227,9 @@ void GraphicsWindow::MouseScroll(double x, double y, int delta) {
|
|||
|
||||
if(delta > 0) {
|
||||
scale *= 1.2;
|
||||
} else {
|
||||
} else if(delta < 0) {
|
||||
scale /= 1.2;
|
||||
}
|
||||
} else return;
|
||||
|
||||
double rightf = x/scale - offsetRight;
|
||||
double upf = y/scale - offsetUp;
|
||||
|
@ -1239,7 +1239,7 @@ void GraphicsWindow::MouseScroll(double x, double y, int delta) {
|
|||
|
||||
if(SS.TW.shown.screen == TextWindow::SCREEN_EDIT_VIEW) {
|
||||
if(havePainted) {
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
}
|
||||
}
|
||||
havePainted = false;
|
||||
|
@ -1303,7 +1303,7 @@ void GraphicsWindow::SpaceNavigatorMoved(double tx, double ty, double tz,
|
|||
lastSpaceNavigatorTime = now;
|
||||
lastSpaceNavigatorGroup = g->h;
|
||||
SS.MarkGroupDirty(g->h);
|
||||
SS.later.generateAll = true;
|
||||
SS.ScheduleGenerateAll();
|
||||
} else {
|
||||
// Apply the transformation to the view of the everything. The
|
||||
// x and y components are translation; but z component is scale,
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
SolveSpace SS;
|
||||
Sketch SK;
|
||||
|
||||
void SolveSpace::Init(char *cmdLine) {
|
||||
void SolveSpace::Init(const char *cmdLine) {
|
||||
SS.tangentArcRadius = 10.0;
|
||||
|
||||
// Then, load the registry settings.
|
||||
|
@ -187,6 +187,18 @@ void SolveSpace::Exit(void) {
|
|||
ExitNow();
|
||||
}
|
||||
|
||||
void SolveSpace::ScheduleGenerateAll() {
|
||||
if(!later.scheduled) ScheduleLater();
|
||||
later.scheduled = true;
|
||||
later.generateAll = true;
|
||||
}
|
||||
|
||||
void SolveSpace::ScheduleShowTW() {
|
||||
if(!later.scheduled) ScheduleLater();
|
||||
later.scheduled = true;
|
||||
later.showTW = true;
|
||||
}
|
||||
|
||||
void SolveSpace::DoLater(void) {
|
||||
if(later.generateAll) GenerateAll();
|
||||
if(later.showTW) TW.Show();
|
||||
|
@ -284,7 +296,7 @@ void SolveSpace::AfterNewFile(void) {
|
|||
GW.ZoomToFit(true);
|
||||
|
||||
GenerateAll(0, INT_MAX);
|
||||
later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
// Then zoom to fit again, to fit the triangles
|
||||
GW.ZoomToFit(false);
|
||||
|
||||
|
@ -295,7 +307,7 @@ void SolveSpace::AfterNewFile(void) {
|
|||
UpdateWindowTitle();
|
||||
}
|
||||
|
||||
void SolveSpace::RemoveFromRecentList(char *file) {
|
||||
void SolveSpace::RemoveFromRecentList(const char *file) {
|
||||
int src, dest;
|
||||
dest = 0;
|
||||
for(src = 0; src < MAX_RECENT; src++) {
|
||||
|
@ -307,7 +319,7 @@ void SolveSpace::RemoveFromRecentList(char *file) {
|
|||
while(dest < MAX_RECENT) strcpy(RecentFile[dest++], "");
|
||||
RefreshRecentMenus();
|
||||
}
|
||||
void SolveSpace::AddToRecentList(char *file) {
|
||||
void SolveSpace::AddToRecentList(const char *file) {
|
||||
RemoveFromRecentList(file);
|
||||
|
||||
int src;
|
||||
|
@ -507,7 +519,7 @@ void SolveSpace::MenuAnalyze(int id) {
|
|||
// so force that to be shown.
|
||||
SS.GW.ForceTextWindowShown();
|
||||
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
SS.GW.ClearSelection();
|
||||
} else {
|
||||
Error("Constraint must have a label, and must not be "
|
||||
|
@ -738,7 +750,12 @@ void SolveSpace::MenuHelp(int id) {
|
|||
"There is NO WARRANTY, to the extent permitted by\n"
|
||||
"law. For details, visit http://gnu.org/licenses/\n"
|
||||
"\n"
|
||||
"\xa9 2008-2013 Jonathan Westhues and other authors.\n"
|
||||
#ifdef WIN32
|
||||
"\xa9 "
|
||||
#else
|
||||
"© "
|
||||
#endif
|
||||
"2008-2013 Jonathan Westhues and other authors.\n"
|
||||
);
|
||||
break;
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ void RefreshRecentMenus(void);
|
|||
#define SAVE_CANCEL (0)
|
||||
int SaveFileYesNoCancel(void);
|
||||
|
||||
#ifdef HAVE_FLTK
|
||||
#if defined(HAVE_FLTK)
|
||||
// Selection pattern format for FLTK's file chooser classes:
|
||||
// "PNG File\t*.png\n"
|
||||
// "JPEG File\t*.{jpg,jpeg}\n"
|
||||
|
@ -139,6 +139,14 @@ int SaveFileYesNoCancel(void);
|
|||
# define PAT1(desc,e1) desc "\t*." e1 "\n"
|
||||
# define PAT2(desc,e1,e2) desc "\t*.{" e1 "," e2 "}\n"
|
||||
# define ENDPAT "All Files\t*"
|
||||
#elif defined(HAVE_GTK)
|
||||
// Selection pattern format to be parsed by GTK3 glue code:
|
||||
// "PNG File\t*.png\n"
|
||||
// "JPEG File\t*.jpg\t*.jpeg\n"
|
||||
// "All Files\t*"
|
||||
# define PAT1(desc,e1) desc "\t*." e1 "\n"
|
||||
# define PAT2(desc,e1,e2) desc "\t*." e1 "\t*." e2 "\n"
|
||||
# define ENDPAT "All Files\t*"
|
||||
#else
|
||||
// Selection pattern format for Win32's OPENFILENAME.lpstrFilter:
|
||||
// "PNG File (*.png)\0*.png\0"
|
||||
|
@ -231,6 +239,7 @@ void SetWindowTitle(const char *str);
|
|||
void SetMousePointerToHand(bool yes);
|
||||
void DoMessageBox(const char *str, int rows, int cols, bool error);
|
||||
void SetTimerFor(int milliseconds);
|
||||
void ScheduleLater();
|
||||
void ExitNow(void);
|
||||
|
||||
void CnfFreezeString(const char *str, const char *name);
|
||||
|
@ -522,7 +531,7 @@ public:
|
|||
|
||||
static double MmToPts(double mm);
|
||||
|
||||
static VectorFileWriter *ForFile(char *file);
|
||||
static VectorFileWriter *ForFile(const char *file);
|
||||
|
||||
void Output(SBezierLoopSetSet *sblss, SMesh *sm);
|
||||
|
||||
|
@ -775,15 +784,15 @@ public:
|
|||
bool tangentArcDeleteOld;
|
||||
|
||||
// The platform-dependent code calls this before entering the msg loop
|
||||
void Init(char *cmdLine);
|
||||
void Init(const char *cmdLine);
|
||||
void Exit(void);
|
||||
|
||||
// File load/save routines, including the additional files that get
|
||||
// loaded when we have import groups.
|
||||
FILE *fh;
|
||||
void AfterNewFile(void);
|
||||
static void RemoveFromRecentList(char *file);
|
||||
static void AddToRecentList(char *file);
|
||||
static void RemoveFromRecentList(const char *file);
|
||||
static void AddToRecentList(const char *file);
|
||||
char saveFile[MAX_PATH];
|
||||
bool fileLoadError;
|
||||
bool unsaved;
|
||||
|
@ -811,18 +820,18 @@ public:
|
|||
void UpdateWindowTitle(void);
|
||||
void ClearExisting(void);
|
||||
void NewFile(void);
|
||||
bool SaveToFile(char *filename);
|
||||
bool LoadFromFile(char *filename);
|
||||
bool LoadEntitiesFromFile(char *filename, EntityList *le,
|
||||
bool SaveToFile(const char *filename);
|
||||
bool LoadFromFile(const char *filename);
|
||||
bool LoadEntitiesFromFile(const char *filename, EntityList *le,
|
||||
SMesh *m, SShell *sh);
|
||||
void ReloadAllImported(void);
|
||||
// And the various export options
|
||||
void ExportAsPngTo(char *file);
|
||||
void ExportMeshTo(char *file);
|
||||
void ExportAsPngTo(const char *file);
|
||||
void ExportMeshTo(const char *file);
|
||||
void ExportMeshAsStlTo(FILE *f, SMesh *sm);
|
||||
void ExportMeshAsObjTo(FILE *f, SMesh *sm);
|
||||
void ExportViewOrWireframeTo(char *file, bool wireframe);
|
||||
void ExportSectionTo(char *file);
|
||||
void ExportViewOrWireframeTo(const char *file, bool wireframe);
|
||||
void ExportSectionTo(const char *file);
|
||||
void ExportWireframeCurves(SEdgeList *sel, SBezierList *sbl,
|
||||
VectorFileWriter *out);
|
||||
void ExportLinesAndMesh(SEdgeList *sel, SBezierList *sbl, SMesh *sm,
|
||||
|
@ -905,9 +914,12 @@ public:
|
|||
bool allConsistent;
|
||||
|
||||
struct {
|
||||
bool scheduled;
|
||||
bool showTW;
|
||||
bool generateAll;
|
||||
} later;
|
||||
void ScheduleShowTW();
|
||||
void ScheduleGenerateAll();
|
||||
void DoLater(void);
|
||||
|
||||
static void MenuHelp(int id);
|
||||
|
|
|
@ -167,12 +167,12 @@ void Style::AssignSelectionToStyle(uint32_t v) {
|
|||
|
||||
SS.GW.ClearSelection();
|
||||
InvalidateGraphics();
|
||||
SS.later.generateAll = true;
|
||||
SS.ScheduleGenerateAll();
|
||||
|
||||
// And show that style's info screen in the text window.
|
||||
SS.TW.GoToScreen(TextWindow::SCREEN_STYLE_INFO);
|
||||
SS.TW.shown.style.v = v;
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -424,7 +424,7 @@ err:
|
|||
if(png_ptr) png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
if(f) fclose(f);
|
||||
}
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
}
|
||||
|
||||
void TextWindow::ScreenChangeBackgroundImageScale(int link, uint32_t v) {
|
||||
|
|
|
@ -78,7 +78,7 @@ void TextWindow::ReportHowGroupSolved(hGroup hg) {
|
|||
SS.GW.ClearSuper();
|
||||
SS.TW.GoToScreen(SCREEN_GROUP_SOLVE_INFO);
|
||||
SS.TW.shown.group.v = hg.v;
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
}
|
||||
void TextWindow::ScreenHowGroupSolved(int link, uint32_t v) {
|
||||
if(SS.GW.activeGroup.v != v) {
|
||||
|
@ -650,7 +650,7 @@ void TextWindow::EditControlDone(const char *s) {
|
|||
}
|
||||
|
||||
SS.MarkGroupDirty(g->h);
|
||||
SS.later.generateAll = true;
|
||||
SS.ScheduleGenerateAll();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ void TextWindow::EditControlDone(const char *s) {
|
|||
Group *g = SK.GetGroup(edit.group);
|
||||
g->scale = ev;
|
||||
SS.MarkGroupDirty(g->h);
|
||||
SS.later.generateAll = true;
|
||||
SS.ScheduleGenerateAll();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -690,7 +690,7 @@ void TextWindow::EditControlDone(const char *s) {
|
|||
g->color = RGBf(rgb.x, rgb.y, rgb.z);
|
||||
|
||||
SS.MarkGroupDirty(g->h);
|
||||
SS.later.generateAll = true;
|
||||
SS.ScheduleGenerateAll();
|
||||
SS.GW.ClearSuper();
|
||||
} else {
|
||||
Error("Bad format: specify color as r, g, b");
|
||||
|
@ -703,7 +703,7 @@ void TextWindow::EditControlDone(const char *s) {
|
|||
if(r) {
|
||||
r->str.strcpy(s);
|
||||
SS.MarkGroupDirty(r->group);
|
||||
SS.later.generateAll = true;
|
||||
SS.ScheduleGenerateAll();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -748,7 +748,7 @@ void TextWindow::EditControlDone(const char *s) {
|
|||
}
|
||||
}
|
||||
InvalidateGraphics();
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
|
||||
if(!edit.showAgain) {
|
||||
HideEditControl();
|
||||
|
|
|
@ -90,7 +90,7 @@ void TextWindow::ShowEditControlWithColorPicker(int halfRow, int col, RgbColor r
|
|||
char str[1024];
|
||||
sprintf(str, "%.2f, %.2f, %.2f", rgb.redF(), rgb.greenF(), rgb.blueF());
|
||||
|
||||
SS.later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
|
||||
editControl.colorPicker.show = true;
|
||||
editControl.colorPicker.rgb = rgb;
|
||||
|
|
6
src/ui.h
6
src/ui.h
|
@ -427,11 +427,17 @@ public:
|
|||
SHIFT_MASK = 0x100,
|
||||
CTRL_MASK = 0x200
|
||||
};
|
||||
enum MenuItemKind {
|
||||
MENU_ITEM_NORMAL = 0,
|
||||
MENU_ITEM_CHECK,
|
||||
MENU_ITEM_RADIO
|
||||
};
|
||||
typedef struct {
|
||||
int level; // 0 == on menu bar, 1 == one level down
|
||||
const char *label; // or NULL for a separator
|
||||
int id; // unique ID
|
||||
int accel; // keyboard accelerator
|
||||
MenuItemKind kind;
|
||||
MenuHandler *fn;
|
||||
} MenuEntry;
|
||||
static const MenuEntry menu[];
|
||||
|
|
|
@ -128,7 +128,7 @@ void SolveSpace::PopOntoCurrentFrom(UndoStack *uk) {
|
|||
SS.TW.ClearSuper();
|
||||
SS.ReloadAllImported();
|
||||
SS.GenerateAll(0, INT_MAX);
|
||||
later.showTW = true;
|
||||
SS.ScheduleShowTW();
|
||||
}
|
||||
|
||||
void SolveSpace::UndoClearStack(UndoStack *uk) {
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "solvespace.h"
|
||||
|
||||
|
@ -34,6 +35,13 @@ void GetAbsoluteFilename(char *file)
|
|||
strcpy(file, expanded);
|
||||
}
|
||||
|
||||
int64_t GetUnixTime(void)
|
||||
{
|
||||
time_t ret;
|
||||
time(&ret);
|
||||
return (int64_t)ret;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// A separate heap, on which we allocate expressions. Maybe a bit faster,
|
||||
// since fragmentation is less of a concern, and it also makes it possible
|
||||
|
|
|
@ -240,6 +240,10 @@ void SetTimerFor(int milliseconds)
|
|||
SetTimer(GraphicsWnd, 1, milliseconds, TimerCallback);
|
||||
}
|
||||
|
||||
void ScheduleLater()
|
||||
{
|
||||
}
|
||||
|
||||
static void GetWindowSize(HWND hwnd, int *w, int *h)
|
||||
{
|
||||
RECT r;
|
||||
|
|
Loading…
Reference in New Issue