Compare commits

...

36 Commits
0.26 ... 0.27

Author SHA1 Message Date
Paul Kulchenko
ef60786e48 Removed debug output when coroutines are edited 2012-02-14 23:35:56 -08:00
Paul Kulchenko
f9c15faab8 Fixed activation of a correct tab when one of the editor tabs is closed 2012-02-13 18:30:45 -08:00
Paul Kulchenko
59b28ef35c Merge branch 'master' of git://estrelaeditor.git.sourceforge.net/gitroot/estrelaeditor/estrelaeditor 2012-02-12 22:42:12 -08:00
Paul Kulchenko
9db7d4ec8a Fixed an issue with file activation from a debugger (files that are 'required' now actiate correctly) 2012-02-12 22:41:41 -08:00
Paul Kulchenko
40eaace714 Disabled dynamic words in the config (zbstudio) 2012-02-10 09:47:05 -08:00
Paul Kulchenko
fe000bb59e Wrapped DragAcceptFiles into a protected call to make it not fail on MacOS (compiled with wxwidgets 2.8.12) 2012-02-09 12:23:47 -08:00
crazybutcher
9aa220df41 Merge branch 'master' of ssh://estrelaeditor.git.sourceforge.net/gitroot/estrelaeditor/estrelaeditor 2012-02-08 20:05:33 +01:00
Paul Kulchenko
97c52f15f3 Added highlight style to markup 2012-02-07 23:41:29 -08:00
Paul Kulchenko
54f578790b Merge branch 'master' of git://estrelaeditor.git.sourceforge.net/gitroot/estrelaeditor/estrelaeditor 2012-02-01 22:29:54 -08:00
Paul Kulchenko
a51a08c1b8 Removed slash conversion in filename on Save; added markup styling on SaveAs 2012-02-01 22:29:28 -08:00
Paul Kulchenko
7620e758a0 Updated error messages to more generic ones 2012-02-01 19:52:55 -08:00
Paul Kulchenko
80da9253dd Normalized the filename path to remove '.' and such 2012-02-01 19:33:08 -08:00
Paul Kulchenko
a133fa900e Fixed the issue of ClosePage method being called with two different parameters 2012-01-31 23:00:55 -08:00
Paul Kulchenko
0fa62e544a Updated markup processing with run and debug commands, http link processing, and opening local files in a new window. Switched from hotspot click event to mouse button processing to avoid the issue with selection being active in a newly loaded page 2012-01-31 22:56:18 -08:00
Paul Kulchenko
601dbef6e5 Added Debug and Run methods to simulate menu commands 2012-01-31 22:49:09 -08:00
unknown
01b3a4fd09 Merge branch 'master' of ssh://estrelaeditor.git.sourceforge.net/gitroot/estrelaeditor/estrelaeditor 2012-01-31 12:08:36 +01:00
crazybutcher
ed0df13acb dx backwards compat mode and replace / in filenames 2012-01-31 12:06:55 +01:00
Paul Kulchenko
642fd63724 Added setting a project folder on initial start (zbstudio) 2012-01-30 18:21:51 -08:00
Paul Kulchenko
a1586cd530 Replaced hardcoded path separater with a method call 2012-01-30 18:19:18 -08:00
Paul Kulchenko
291cba2d79 Merge branch 'master' of git://estrelaeditor.git.sourceforge.net/gitroot/estrelaeditor/estrelaeditor 2012-01-30 15:58:40 -08:00
Paul Kulchenko
96bffc1322 Added markup formatting in the comments 2012-01-30 15:58:28 -08:00
Paul Kulchenko
e88710fbbc Updated debugger to use project dir as basedir if it is specified (rather than the path to the currently edited file) 2012-01-30 15:03:22 -08:00
Paul Kulchenko
99da8be0f8 Fixed the issue of the project dir being returned with two trailing slashes 2012-01-30 15:03:05 -08:00
crazybutcher
c8c654cb2b removed ptx r,g,b,a keywords 2012-01-30 22:05:47 +01:00
crazybutcher
cf68a42547 added nvidia ptx spec 2012-01-30 22:01:57 +01:00
Paul Kulchenko
5c0d4cccdd Added setting the current project directory for the shell to allow 'require' commands to work with local modules 2012-01-29 17:10:55 -08:00
Paul Kulchenko
b979b41688 Fixed an issue with activating the currenly edited file in the file tree 2012-01-29 13:55:59 -08:00
Paul Kulchenko
b807fa9a99 Enforced visibility for shell prompt 2012-01-28 11:59:18 -08:00
Paul Kulchenko
ef5b1b0e09 Removed hardcoded references to the console page/tab 2012-01-28 11:53:56 -08:00
Paul Kulchenko
04a038da45 Moved wrap flags to the line end to make them less noticeable 2012-01-28 11:52:17 -08:00
Paul Kulchenko
bc0e3190d4 Added style processing for font name, font size, visibility and hotspot attributes 2012-01-28 11:20:52 -08:00
Paul Kulchenko
16dcd084e1 Renamed ShellExecuteCode to ...File; added ShellExecuteCode to execute a fragment of code 2012-01-28 10:52:35 -08:00
crazybutcher
15f8c15039 bugfix on close-file 2012-01-25 22:00:28 +01:00
crazybutcher
bff0da36dc minor updates to license (2012) and readme (front-ends explained) 2012-01-21 14:27:03 +01:00
crazybutcher
1e933a6b75 Merge remote-tracking branch 'zbstudio/master' 2012-01-21 14:15:06 +01:00
crazybutcher
c9bb3e01ca added glfw 2.7.2 api and changed luxinia2 to use it instead of glfw3 2012-01-21 14:13:54 +01:00
23 changed files with 1726 additions and 113 deletions

View File

@@ -2,7 +2,7 @@
ZeroBrane Studio sources are released under the MIT License
Copyright (c) 2011 Paul Kulchenko (paul@kulchenko.com)
Copyright (c) 2011-2012 Paul Kulchenko (paul@kulchenko.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -26,9 +26,9 @@ THE SOFTWARE.
Estrela Editor sources are released under the MIT License
Copyright (c) 2008-2011
Copyright (c) 2008-2012
Luxinia DevTeam:
Eike Decker & Christoph Kubisch
Christoph Kubisch & Eike Decker
info at luxinia.de
Permission is hereby granted, free of charge, to any person obtaining a copy

11
README
View File

@@ -23,6 +23,15 @@ tools. Its main focus is extensibility for target applications using Lua.
* Console to directly test code snippets with local and remote execution
* Integrated debugger (with support for local and remote debugging)
--[[ FRONT-ENDS ]]--------------------------------------------------------
There is currently two front-ends using the same editor engine. The original
is "estrela", which has a focus on 3d graphics related usage of Lua, especially
in combination with the luxinia engine or luxinia2 framework.
The second is "zbstudio" which has a focus on remote use of Lua in robotics.
Both are part of the standard distribution.
--[[ INSTALLATION ]]-------------------------------------------------------
git clone git://github.com/pkulchenko/ZeroBraneStudio.git zbstudio
@@ -43,7 +52,7 @@ Overriding Config:
Estrela Editor
Luxinia DevTeam: Eike Decker & Christoph Kubisch (info at luxinia.de)
Luxinia Dev: Christoph Kubisch (crazybutcher@luxinia.de)
ZeroBrane Studio and MobDebug

930
api/lua/glfw.lua Normal file
View File

@@ -0,0 +1,930 @@
--[[// glfw | GLFW window manager
enum {
/*************************************************************************
* GLFW version
*************************************************************************/
GLFW_VERSION_MAJOR =2,
GLFW_VERSION_MINOR =7,
GLFW_VERSION_REVISION =2,
/*************************************************************************
* Input handling definitions
*************************************************************************/
/* Key and button state/action definitions */
GLFW_RELEASE =0,
GLFW_PRESS =1,
GLFW_TRUE = 1,
GLFW_FALSE = 0,
/* Keyboard key definitions: 8-bit ISO-8859-1 (Latin 1) encoding is used
* for printable keys (such as A-Z, 0-9 etc), and values above 256
* represent special (non-printable) keys (e.g. F1, Page Up etc).
*/
GLFW_KEY_UNKNOWN =-1,
GLFW_KEY_SPACE =32,
GLFW_KEY_APOSTROPHE = 39,
GLFW_KEY_COMMA = 44,
GLFW_KEY_MINUS = 45,
GLFW_KEY_PERIOD = 46,
GLFW_KEY_SLASH = 47,
GLFW_KEY_0 = 48,
GLFW_KEY_1 = 49,
GLFW_KEY_2 = 50,
GLFW_KEY_3 = 51,
GLFW_KEY_4 = 52,
GLFW_KEY_5 = 53,
GLFW_KEY_6 = 54,
GLFW_KEY_7 = 55,
GLFW_KEY_8 = 56,
GLFW_KEY_9 = 57,
GLFW_KEY_SEMICOLON = 59,
GLFW_KEY_EQUAL = 61,
GLFW_KEY_A = 65,
GLFW_KEY_B = 66,
GLFW_KEY_C = 67,
GLFW_KEY_D = 68,
GLFW_KEY_E = 69,
GLFW_KEY_F = 70,
GLFW_KEY_G = 71,
GLFW_KEY_H = 72,
GLFW_KEY_I = 73,
GLFW_KEY_J = 74,
GLFW_KEY_K = 75,
GLFW_KEY_L = 76,
GLFW_KEY_M = 77,
GLFW_KEY_N = 78,
GLFW_KEY_O = 79,
GLFW_KEY_P = 80,
GLFW_KEY_Q = 81,
GLFW_KEY_R = 82,
GLFW_KEY_S = 83,
GLFW_KEY_T = 84,
GLFW_KEY_U = 85,
GLFW_KEY_V = 86,
GLFW_KEY_W = 87,
GLFW_KEY_X = 88,
GLFW_KEY_Y = 89,
GLFW_KEY_Z = 90,
GLFW_KEY_LEFT_BRACKET = 91,
GLFW_KEY_BACKSLASH = 92,
GLFW_KEY_RIGHT_BRACKET = 93,
GLFW_KEY_GRAVE_ACCENT = 96,
GLFW_KEY_WORLD_1 = 161,
GLFW_KEY_WORLD_2 = 162,
GLFW_KEY_SPECIAL =256,
GLFW_KEY_ESC =(GLFW_KEY_SPECIAL+1),
GLFW_KEY_F1 =(GLFW_KEY_SPECIAL+2),
GLFW_KEY_F2 =(GLFW_KEY_SPECIAL+3),
GLFW_KEY_F3 =(GLFW_KEY_SPECIAL+4),
GLFW_KEY_F4 =(GLFW_KEY_SPECIAL+5),
GLFW_KEY_F5 =(GLFW_KEY_SPECIAL+6),
GLFW_KEY_F6 =(GLFW_KEY_SPECIAL+7),
GLFW_KEY_F7 =(GLFW_KEY_SPECIAL+8),
GLFW_KEY_F8 =(GLFW_KEY_SPECIAL+9),
GLFW_KEY_F9 =(GLFW_KEY_SPECIAL+10),
GLFW_KEY_F10 =(GLFW_KEY_SPECIAL+11),
GLFW_KEY_F11 =(GLFW_KEY_SPECIAL+12),
GLFW_KEY_F12 =(GLFW_KEY_SPECIAL+13),
GLFW_KEY_F13 =(GLFW_KEY_SPECIAL+14),
GLFW_KEY_F14 =(GLFW_KEY_SPECIAL+15),
GLFW_KEY_F15 =(GLFW_KEY_SPECIAL+16),
GLFW_KEY_F16 =(GLFW_KEY_SPECIAL+17),
GLFW_KEY_F17 =(GLFW_KEY_SPECIAL+18),
GLFW_KEY_F18 =(GLFW_KEY_SPECIAL+19),
GLFW_KEY_F19 =(GLFW_KEY_SPECIAL+20),
GLFW_KEY_F20 =(GLFW_KEY_SPECIAL+21),
GLFW_KEY_F21 =(GLFW_KEY_SPECIAL+22),
GLFW_KEY_F22 =(GLFW_KEY_SPECIAL+23),
GLFW_KEY_F23 =(GLFW_KEY_SPECIAL+24),
GLFW_KEY_F24 =(GLFW_KEY_SPECIAL+25),
GLFW_KEY_F25 =(GLFW_KEY_SPECIAL+26),
GLFW_KEY_UP =(GLFW_KEY_SPECIAL+27),
GLFW_KEY_DOWN =(GLFW_KEY_SPECIAL+28),
GLFW_KEY_LEFT =(GLFW_KEY_SPECIAL+29),
GLFW_KEY_RIGHT =(GLFW_KEY_SPECIAL+30),
GLFW_KEY_LSHIFT =(GLFW_KEY_SPECIAL+31),
GLFW_KEY_RSHIFT =(GLFW_KEY_SPECIAL+32),
GLFW_KEY_LCTRL =(GLFW_KEY_SPECIAL+33),
GLFW_KEY_RCTRL =(GLFW_KEY_SPECIAL+34),
GLFW_KEY_LALT =(GLFW_KEY_SPECIAL+35),
GLFW_KEY_RALT =(GLFW_KEY_SPECIAL+36),
GLFW_KEY_TAB =(GLFW_KEY_SPECIAL+37),
GLFW_KEY_ENTER =(GLFW_KEY_SPECIAL+38),
GLFW_KEY_BACKSPACE =(GLFW_KEY_SPECIAL+39),
GLFW_KEY_INSERT =(GLFW_KEY_SPECIAL+40),
GLFW_KEY_DEL =(GLFW_KEY_SPECIAL+41),
GLFW_KEY_PAGEUP =(GLFW_KEY_SPECIAL+42),
GLFW_KEY_PAGEDOWN =(GLFW_KEY_SPECIAL+43),
GLFW_KEY_HOME =(GLFW_KEY_SPECIAL+44),
GLFW_KEY_END =(GLFW_KEY_SPECIAL+45),
GLFW_KEY_KP_0 =(GLFW_KEY_SPECIAL+46),
GLFW_KEY_KP_1 =(GLFW_KEY_SPECIAL+47),
GLFW_KEY_KP_2 =(GLFW_KEY_SPECIAL+48),
GLFW_KEY_KP_3 =(GLFW_KEY_SPECIAL+49),
GLFW_KEY_KP_4 =(GLFW_KEY_SPECIAL+50),
GLFW_KEY_KP_5 =(GLFW_KEY_SPECIAL+51),
GLFW_KEY_KP_6 =(GLFW_KEY_SPECIAL+52),
GLFW_KEY_KP_7 =(GLFW_KEY_SPECIAL+53),
GLFW_KEY_KP_8 =(GLFW_KEY_SPECIAL+54),
GLFW_KEY_KP_9 =(GLFW_KEY_SPECIAL+55),
GLFW_KEY_KP_DIVIDE =(GLFW_KEY_SPECIAL+56),
GLFW_KEY_KP_MULTIPLY =(GLFW_KEY_SPECIAL+57),
GLFW_KEY_KP_SUBTRACT =(GLFW_KEY_SPECIAL+58),
GLFW_KEY_KP_ADD =(GLFW_KEY_SPECIAL+59),
GLFW_KEY_KP_DECIMAL =(GLFW_KEY_SPECIAL+60),
GLFW_KEY_KP_EQUAL =(GLFW_KEY_SPECIAL+61),
GLFW_KEY_KP_ENTER =(GLFW_KEY_SPECIAL+62),
GLFW_KEY_KP_NUM_LOCK =(GLFW_KEY_SPECIAL+63),
GLFW_KEY_CAPS_LOCK =(GLFW_KEY_SPECIAL+64),
GLFW_KEY_SCROLL_LOCK =(GLFW_KEY_SPECIAL+65),
GLFW_KEY_PAUSE =(GLFW_KEY_SPECIAL+66),
GLFW_KEY_LSUPER =(GLFW_KEY_SPECIAL+67),
GLFW_KEY_RSUPER =(GLFW_KEY_SPECIAL+68),
GLFW_KEY_MENU =(GLFW_KEY_SPECIAL+69),
GLFW_KEY_LAST =GLFW_KEY_MENU,
/* Mouse button definitions */
GLFW_MOUSE_BUTTON_1 =0,
GLFW_MOUSE_BUTTON_2 =1,
GLFW_MOUSE_BUTTON_3 =2,
GLFW_MOUSE_BUTTON_4 =3,
GLFW_MOUSE_BUTTON_5 =4,
GLFW_MOUSE_BUTTON_6 =5,
GLFW_MOUSE_BUTTON_7 =6,
GLFW_MOUSE_BUTTON_8 =7,
GLFW_MOUSE_BUTTON_LAST =GLFW_MOUSE_BUTTON_8,
/* Mouse button aliases */
GLFW_MOUSE_BUTTON_LEFT =GLFW_MOUSE_BUTTON_1,
GLFW_MOUSE_BUTTON_RIGHT =GLFW_MOUSE_BUTTON_2,
GLFW_MOUSE_BUTTON_MIDDLE =GLFW_MOUSE_BUTTON_3,
/* Joystick identifiers */
GLFW_JOYSTICK_1 =0,
GLFW_JOYSTICK_2 =1,
GLFW_JOYSTICK_3 =2,
GLFW_JOYSTICK_4 =3,
GLFW_JOYSTICK_5 =4,
GLFW_JOYSTICK_6 =5,
GLFW_JOYSTICK_7 =6,
GLFW_JOYSTICK_8 =7,
GLFW_JOYSTICK_9 =8,
GLFW_JOYSTICK_10 =9,
GLFW_JOYSTICK_11 =10,
GLFW_JOYSTICK_12 =11,
GLFW_JOYSTICK_13 =12,
GLFW_JOYSTICK_14 =13,
GLFW_JOYSTICK_15 =14,
GLFW_JOYSTICK_16 =15,
GLFW_JOYSTICK_LAST =GLFW_JOYSTICK_16,
/*************************************************************************
* Other definitions
*************************************************************************/
/* glfwOpenWindow modes */
GLFW_WINDOW =0x00010001,
GLFW_FULLSCREEN =0x00010002,
/* glfwGetWindowParam tokens */
GLFW_OPENED =0x00020001,
GLFW_ACTIVE =0x00020002,
GLFW_ICONIFIED =0x00020003,
GLFW_ACCELERATED =0x00020004,
GLFW_RED_BITS =0x00020005,
GLFW_GREEN_BITS =0x00020006,
GLFW_BLUE_BITS =0x00020007,
GLFW_ALPHA_BITS =0x00020008,
GLFW_DEPTH_BITS =0x00020009,
GLFW_STENCIL_BITS =0x0002000A,
/* The following constants are used for both glfwGetWindowParam
* and glfwOpenWindowHint
*/
GLFW_REFRESH_RATE =0x0002000B,
GLFW_ACCUM_RED_BITS =0x0002000C,
GLFW_ACCUM_GREEN_BITS =0x0002000D,
GLFW_ACCUM_BLUE_BITS =0x0002000E,
GLFW_ACCUM_ALPHA_BITS =0x0002000F,
GLFW_AUX_BUFFERS =0x00020010,
GLFW_STEREO =0x00020011,
GLFW_WINDOW_NO_RESIZE =0x00020012,
GLFW_FSAA_SAMPLES =0x00020013,
GLFW_OPENGL_VERSION_MAJOR =0x00020014,
GLFW_OPENGL_VERSION_MINOR =0x00020015,
GLFW_OPENGL_FORWARD_COMPAT =0x00020016,
GLFW_OPENGL_DEBUG_CONTEXT =0x00020017,
GLFW_OPENGL_PROFILE =0x00020018,
/* GLFW_OPENGL_PROFILE tokens */
GLFW_OPENGL_CORE_PROFILE =0x00050001,
GLFW_OPENGL_COMPAT_PROFILE =0x00050002,
/* glfwEnable/glfwDisable tokens */
GLFW_MOUSE_CURSOR =0x00030001,
GLFW_STICKY_KEYS =0x00030002,
GLFW_STICKY_MOUSE_BUTTONS =0x00030003,
GLFW_SYSTEM_KEYS =0x00030004,
GLFW_KEY_REPEAT =0x00030005,
GLFW_AUTO_POLL_EVENTS =0x00030006,
/* glfwWaitThread wait modes */
GLFW_WAIT =0x00040001,
GLFW_NOWAIT =0x00040002,
/* glfwGetJoystickParam tokens */
GLFW_PRESENT =0x00050001,
GLFW_AXES =0x00050002,
GLFW_BUTTONS =0x00050003,
/* glfwReadImage/glfwLoadTexture2D flags */
GLFW_NO_RESCALE_BIT =0x00000001 /* Only for glfwReadImage */,
GLFW_ORIGIN_UL_BIT =0x00000002,
GLFW_BUILD_MIPMAPS_BIT =0x00000004 /* Only for glfwLoadTexture2D */,
GLFW_ALPHA_MAP_BIT =0x00000008,
/* Time spans longer than this (seconds) are considered to be infinity */
};
const float GLFW_INFINITY =100000.0;
/* The video mode structure used by glfwGetVideoModes() */
typedef struct {
int Width, Height;
int RedBits, BlueBits, GreenBits;
} GLFWvidmode;
/* Image/texture information */
typedef struct {
int Width, Height;
int Format;
int BytesPerPixel;
unsigned char *Data;
} GLFWimage;
/* Thread ID */
typedef int GLFWthread;
/* Mutex object */
typedef void * GLFWmutex;
/* Condition variable object */
typedef void * GLFWcond;
/* Function pointer types */
typedef void (GLFWCALL * GLFWwindowsizefun)(int,int);
typedef int (GLFWCALL * GLFWwindowclosefun)(void);
typedef void (GLFWCALL * GLFWwindowrefreshfun)(void);
typedef void (GLFWCALL * GLFWmousebuttonfun)(int,int);
typedef void (GLFWCALL * GLFWmouseposfun)(int,int);
typedef void (GLFWCALL * GLFWmousewheelfun)(int);
typedef void (GLFWCALL * GLFWkeyfun)(int,int);
typedef void (GLFWCALL * GLFWcharfun)(int,int);
typedef void (GLFWCALL * GLFWthreadfun)(void *);
/*************************************************************************
* Prototypes
*************************************************************************/
/* GLFW initialization, termination and version querying */
int glfwInit( void );
void glfwTerminate( void );
void glfwGetVersion( int *major, int *minor, int *rev );
/* Window handling */
int glfwOpenWindow( int width, int height, int redbits, int greenbits, int bluebits, int alphabits, int depthbits, int stencilbits, int mode );
void glfwOpenWindowHint( int target, int hint );
void glfwCloseWindow( void );
void glfwSetWindowTitle( const char *title );
void glfwGetWindowSize( int *width, int *height );
void glfwSetWindowSize( int width, int height );
void glfwSetWindowPos( int x, int y );
void glfwIconifyWindow( void );
void glfwRestoreWindow( void );
void glfwSwapBuffers( void );
void glfwSwapInterval( int interval );
int glfwGetWindowParam( int param );
void glfwSetWindowSizeCallback( GLFWwindowsizefun cbfun );
void glfwSetWindowCloseCallback( GLFWwindowclosefun cbfun );
void glfwSetWindowRefreshCallback( GLFWwindowrefreshfun cbfun );
/* Video mode functions */
int glfwGetVideoModes( GLFWvidmode *list, int maxcount );
void glfwGetDesktopMode( GLFWvidmode *mode );
/* Input handling */
void glfwPollEvents( void );
void glfwWaitEvents( void );
int glfwGetKey( int key );
int glfwGetMouseButton( int button );
void glfwGetMousePos( int *xpos, int *ypos );
void glfwSetMousePos( int xpos, int ypos );
int glfwGetMouseWheel( void );
void glfwSetMouseWheel( int pos );
void glfwSetKeyCallback( GLFWkeyfun cbfun );
void glfwSetCharCallback( GLFWcharfun cbfun );
void glfwSetMouseButtonCallback( GLFWmousebuttonfun cbfun );
void glfwSetMousePosCallback( GLFWmouseposfun cbfun );
void glfwSetMouseWheelCallback( GLFWmousewheelfun cbfun );
/* Joystick input */
int glfwGetJoystickParam( int joy, int param );
int glfwGetJoystickPos( int joy, float *pos, int numaxes );
int glfwGetJoystickButtons( int joy, unsigned char *buttons, int numbuttons );
/* Time */
double glfwGetTime( void );
void glfwSetTime( double time );
void glfwSleep( double time );
/* Extension support */
int glfwExtensionSupported( const char *extension );
void* glfwGetProcAddress( const char *procname );
void glfwGetGLVersion( int *major, int *minor, int *rev );
/* Threading support */
GLFWthread glfwCreateThread( GLFWthreadfun fun, void *arg );
void glfwDestroyThread( GLFWthread ID );
int glfwWaitThread( GLFWthread ID, int waitmode );
GLFWthread glfwGetThreadID( void );
GLFWmutex glfwCreateMutex( void );
void glfwDestroyMutex( GLFWmutex mutex );
void glfwLockMutex( GLFWmutex mutex );
void glfwUnlockMutex( GLFWmutex mutex );
GLFWcond glfwCreateCond( void );
void glfwDestroyCond( GLFWcond cond );
void glfwWaitCond( GLFWcond cond, GLFWmutex mutex, double timeout );
void glfwSignalCond( GLFWcond cond );
void glfwBroadcastCond( GLFWcond cond );
int glfwGetNumberOfProcessors( void );
/* Enable/disable functions */
void glfwEnable( int token );
void glfwDisable( int token );
/* Image/texture I/O support */
int glfwReadImage( const char *name, GLFWimage *img, int flags );
int glfwReadMemoryImage( const void *data, long size, GLFWimage *img, int flags );
void glfwFreeImage( GLFWimage *img );
int glfwLoadTexture2D( const char *name, int flags );
int glfwLoadMemoryTexture2D( const void *data, long size, int flags );
int glfwLoadTextureImage2D( GLFWimage *img, int flags );
]]
--auto-generated api from ffi headers
local api =
{
["GLFW_VERSION_MAJOR"] = { type ='value', },
["GLFW_VERSION_MINOR"] = { type ='value', },
["GLFW_VERSION_REVISION"] = { type ='value', },
["GLFW_RELEASE"] = { type ='value', },
["GLFW_PRESS"] = { type ='value', },
["GLFW_KEY_UNKNOWN"] = { type ='value', },
["GLFW_KEY_SPACE"] = { type ='value', },
["GLFW_KEY_APOSTROPHE"] = { type ='value', },
["GLFW_KEY_COMMA"] = { type ='value', },
["GLFW_KEY_MINUS"] = { type ='value', },
["GLFW_KEY_PERIOD"] = { type ='value', },
["GLFW_KEY_SLASH"] = { type ='value', },
["GLFW_KEY_0"] = { type ='value', },
["GLFW_KEY_1"] = { type ='value', },
["GLFW_KEY_2"] = { type ='value', },
["GLFW_KEY_3"] = { type ='value', },
["GLFW_KEY_4"] = { type ='value', },
["GLFW_KEY_5"] = { type ='value', },
["GLFW_KEY_6"] = { type ='value', },
["GLFW_KEY_7"] = { type ='value', },
["GLFW_KEY_8"] = { type ='value', },
["GLFW_KEY_9"] = { type ='value', },
["GLFW_KEY_SEMICOLON"] = { type ='value', },
["GLFW_KEY_EQUAL"] = { type ='value', },
["GLFW_KEY_A"] = { type ='value', },
["GLFW_KEY_B"] = { type ='value', },
["GLFW_KEY_C"] = { type ='value', },
["GLFW_KEY_D"] = { type ='value', },
["GLFW_KEY_E"] = { type ='value', },
["GLFW_KEY_F"] = { type ='value', },
["GLFW_KEY_G"] = { type ='value', },
["GLFW_KEY_H"] = { type ='value', },
["GLFW_KEY_I"] = { type ='value', },
["GLFW_KEY_J"] = { type ='value', },
["GLFW_KEY_K"] = { type ='value', },
["GLFW_KEY_L"] = { type ='value', },
["GLFW_KEY_M"] = { type ='value', },
["GLFW_KEY_N"] = { type ='value', },
["GLFW_KEY_O"] = { type ='value', },
["GLFW_KEY_P"] = { type ='value', },
["GLFW_KEY_Q"] = { type ='value', },
["GLFW_KEY_R"] = { type ='value', },
["GLFW_KEY_S"] = { type ='value', },
["GLFW_KEY_T"] = { type ='value', },
["GLFW_KEY_U"] = { type ='value', },
["GLFW_KEY_V"] = { type ='value', },
["GLFW_KEY_W"] = { type ='value', },
["GLFW_KEY_X"] = { type ='value', },
["GLFW_KEY_Y"] = { type ='value', },
["GLFW_KEY_Z"] = { type ='value', },
["GLFW_KEY_LEFT_BRACKET"] = { type ='value', },
["GLFW_KEY_BACKSLASH"] = { type ='value', },
["GLFW_KEY_RIGHT_BRACKET"] = { type ='value', },
["GLFW_KEY_GRAVE_ACCENT"] = { type ='value', },
["GLFW_KEY_WORLD_1"] = { type ='value', },
["GLFW_KEY_WORLD_2"] = { type ='value', },
["GLFW_KEY_SPECIAL"] = { type ='value', },
["GLFW_KEY_ESC"] = { type ='value', },
["GLFW_KEY_F1"] = { type ='value', },
["GLFW_KEY_F2"] = { type ='value', },
["GLFW_KEY_F3"] = { type ='value', },
["GLFW_KEY_F4"] = { type ='value', },
["GLFW_KEY_F5"] = { type ='value', },
["GLFW_KEY_F6"] = { type ='value', },
["GLFW_KEY_F7"] = { type ='value', },
["GLFW_KEY_F8"] = { type ='value', },
["GLFW_KEY_F9"] = { type ='value', },
["GLFW_KEY_F10"] = { type ='value', },
["GLFW_KEY_F11"] = { type ='value', },
["GLFW_KEY_F12"] = { type ='value', },
["GLFW_KEY_F13"] = { type ='value', },
["GLFW_KEY_F14"] = { type ='value', },
["GLFW_KEY_F15"] = { type ='value', },
["GLFW_KEY_F16"] = { type ='value', },
["GLFW_KEY_F17"] = { type ='value', },
["GLFW_KEY_F18"] = { type ='value', },
["GLFW_KEY_F19"] = { type ='value', },
["GLFW_KEY_F20"] = { type ='value', },
["GLFW_KEY_F21"] = { type ='value', },
["GLFW_KEY_F22"] = { type ='value', },
["GLFW_KEY_F23"] = { type ='value', },
["GLFW_KEY_F24"] = { type ='value', },
["GLFW_KEY_F25"] = { type ='value', },
["GLFW_KEY_UP"] = { type ='value', },
["GLFW_KEY_DOWN"] = { type ='value', },
["GLFW_KEY_LEFT"] = { type ='value', },
["GLFW_KEY_RIGHT"] = { type ='value', },
["GLFW_KEY_LSHIFT"] = { type ='value', },
["GLFW_KEY_RSHIFT"] = { type ='value', },
["GLFW_KEY_LCTRL"] = { type ='value', },
["GLFW_KEY_RCTRL"] = { type ='value', },
["GLFW_KEY_LALT"] = { type ='value', },
["GLFW_KEY_RALT"] = { type ='value', },
["GLFW_KEY_TAB"] = { type ='value', },
["GLFW_KEY_ENTER"] = { type ='value', },
["GLFW_KEY_BACKSPACE"] = { type ='value', },
["GLFW_KEY_INSERT"] = { type ='value', },
["GLFW_KEY_DEL"] = { type ='value', },
["GLFW_KEY_PAGEUP"] = { type ='value', },
["GLFW_KEY_PAGEDOWN"] = { type ='value', },
["GLFW_KEY_HOME"] = { type ='value', },
["GLFW_KEY_END"] = { type ='value', },
["GLFW_KEY_KP_0"] = { type ='value', },
["GLFW_KEY_KP_1"] = { type ='value', },
["GLFW_KEY_KP_2"] = { type ='value', },
["GLFW_KEY_KP_3"] = { type ='value', },
["GLFW_KEY_KP_4"] = { type ='value', },
["GLFW_KEY_KP_5"] = { type ='value', },
["GLFW_KEY_KP_6"] = { type ='value', },
["GLFW_KEY_KP_7"] = { type ='value', },
["GLFW_KEY_KP_8"] = { type ='value', },
["GLFW_KEY_KP_9"] = { type ='value', },
["GLFW_KEY_KP_DIVIDE"] = { type ='value', },
["GLFW_KEY_KP_MULTIPLY"] = { type ='value', },
["GLFW_KEY_KP_SUBTRACT"] = { type ='value', },
["GLFW_KEY_KP_ADD"] = { type ='value', },
["GLFW_KEY_KP_DECIMAL"] = { type ='value', },
["GLFW_KEY_KP_EQUAL"] = { type ='value', },
["GLFW_KEY_KP_ENTER"] = { type ='value', },
["GLFW_KEY_KP_NUM_LOCK"] = { type ='value', },
["GLFW_KEY_CAPS_LOCK"] = { type ='value', },
["GLFW_KEY_SCROLL_LOCK"] = { type ='value', },
["GLFW_KEY_PAUSE"] = { type ='value', },
["GLFW_KEY_LSUPER"] = { type ='value', },
["GLFW_KEY_RSUPER"] = { type ='value', },
["GLFW_KEY_MENU"] = { type ='value', },
["GLFW_KEY_LAST"] = { type ='value', },
["GLFW_MOUSE_BUTTON_1"] = { type ='value', },
["GLFW_MOUSE_BUTTON_2"] = { type ='value', },
["GLFW_MOUSE_BUTTON_3"] = { type ='value', },
["GLFW_MOUSE_BUTTON_4"] = { type ='value', },
["GLFW_MOUSE_BUTTON_5"] = { type ='value', },
["GLFW_MOUSE_BUTTON_6"] = { type ='value', },
["GLFW_MOUSE_BUTTON_7"] = { type ='value', },
["GLFW_MOUSE_BUTTON_8"] = { type ='value', },
["GLFW_MOUSE_BUTTON_LAST"] = { type ='value', },
["GLFW_MOUSE_BUTTON_LEFT"] = { type ='value', },
["GLFW_MOUSE_BUTTON_RIGHT"] = { type ='value', },
["GLFW_MOUSE_BUTTON_MIDDLE"] = { type ='value', },
["GLFW_JOYSTICK_1"] = { type ='value', },
["GLFW_JOYSTICK_2"] = { type ='value', },
["GLFW_JOYSTICK_3"] = { type ='value', },
["GLFW_JOYSTICK_4"] = { type ='value', },
["GLFW_JOYSTICK_5"] = { type ='value', },
["GLFW_JOYSTICK_6"] = { type ='value', },
["GLFW_JOYSTICK_7"] = { type ='value', },
["GLFW_JOYSTICK_8"] = { type ='value', },
["GLFW_JOYSTICK_9"] = { type ='value', },
["GLFW_JOYSTICK_10"] = { type ='value', },
["GLFW_JOYSTICK_11"] = { type ='value', },
["GLFW_JOYSTICK_12"] = { type ='value', },
["GLFW_JOYSTICK_13"] = { type ='value', },
["GLFW_JOYSTICK_14"] = { type ='value', },
["GLFW_JOYSTICK_15"] = { type ='value', },
["GLFW_JOYSTICK_16"] = { type ='value', },
["GLFW_JOYSTICK_LAST"] = { type ='value', },
["GLFW_WINDOW"] = { type ='value', },
["GLFW_FULLSCREEN"] = { type ='value', },
["GLFW_OPENED"] = { type ='value', },
["GLFW_ACTIVE"] = { type ='value', },
["GLFW_ICONIFIED"] = { type ='value', },
["GLFW_ACCELERATED"] = { type ='value', },
["GLFW_RED_BITS"] = { type ='value', },
["GLFW_GREEN_BITS"] = { type ='value', },
["GLFW_BLUE_BITS"] = { type ='value', },
["GLFW_ALPHA_BITS"] = { type ='value', },
["GLFW_DEPTH_BITS"] = { type ='value', },
["GLFW_STENCIL_BITS"] = { type ='value', },
["GLFW_REFRESH_RATE"] = { type ='value', },
["GLFW_ACCUM_RED_BITS"] = { type ='value', },
["GLFW_ACCUM_GREEN_BITS"] = { type ='value', },
["GLFW_ACCUM_BLUE_BITS"] = { type ='value', },
["GLFW_ACCUM_ALPHA_BITS"] = { type ='value', },
["GLFW_AUX_BUFFERS"] = { type ='value', },
["GLFW_STEREO"] = { type ='value', },
["GLFW_WINDOW_NO_RESIZE"] = { type ='value', },
["GLFW_FSAA_SAMPLES"] = { type ='value', },
["GLFW_OPENGL_VERSION_MAJOR"] = { type ='value', },
["GLFW_OPENGL_VERSION_MINOR"] = { type ='value', },
["GLFW_OPENGL_FORWARD_COMPAT"] = { type ='value', },
["GLFW_OPENGL_DEBUG_CONTEXT"] = { type ='value', },
["GLFW_OPENGL_PROFILE"] = { type ='value', },
["GLFW_OPENGL_CORE_PROFILE"] = { type ='value', },
["GLFW_OPENGL_COMPAT_PROFILE"] = { type ='value', },
["GLFW_MOUSE_CURSOR"] = { type ='value', },
["GLFW_STICKY_KEYS"] = { type ='value', },
["GLFW_STICKY_MOUSE_BUTTONS"] = { type ='value', },
["GLFW_SYSTEM_KEYS"] = { type ='value', },
["GLFW_KEY_REPEAT"] = { type ='value', },
["GLFW_AUTO_POLL_EVENTS"] = { type ='value', },
["GLFW_WAIT"] = { type ='value', },
["GLFW_NOWAIT"] = { type ='value', },
["GLFW_PRESENT"] = { type ='value', },
["GLFW_AXES"] = { type ='value', },
["GLFW_BUTTONS"] = { type ='value', },
["GLFW_NO_RESCALE_BIT"] = { type ='value', },
["GLFW_ORIGIN_UL_BIT"] = { type ='value', },
["GLFW_BUILD_MIPMAPS_BIT"] = { type ='value', },
["GLFW_ALPHA_MAP_BIT"] = { type ='value', },
["glfwInit"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(void)", },
["glfwTerminate"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(void)", },
["glfwGetVersion"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(int *major, int *minor, int *rev)", },
["glfwOpenWindow"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(int width, int height, int redbits, int greenbits, int bluebits, int alphabits, int depthbits, int stencilbits, int mode)", },
["glfwOpenWindowHint"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(int target, int hint)", },
["glfwCloseWindow"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(void)", },
["glfwSetWindowTitle"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(const char *title)", },
["glfwGetWindowSize"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(int *width, int *height)", },
["glfwSetWindowSize"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(int width, int height)", },
["glfwSetWindowPos"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(int x, int y)", },
["glfwIconifyWindow"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(void)", },
["glfwRestoreWindow"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(void)", },
["glfwSwapBuffers"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(void)", },
["glfwSwapInterval"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(int interval)", },
["glfwGetWindowParam"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(int param)", },
["glfwSetWindowSizeCallback"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(GLFWwindowsizefun cbfun)", },
["glfwSetWindowCloseCallback"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(GLFWwindowclosefun cbfun)", },
["glfwSetWindowRefreshCallback"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(GLFWwindowrefreshfun cbfun)", },
["glfwGetVideoModes"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(GLFWvidmode *list, int maxcount)", },
["glfwGetDesktopMode"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(GLFWvidmode *mode)", },
["glfwPollEvents"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(void)", },
["glfwWaitEvents"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(void)", },
["glfwGetKey"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(int key)", },
["glfwGetMouseButton"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(int button)", },
["glfwGetMousePos"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(int *xpos, int *ypos)", },
["glfwSetMousePos"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(int xpos, int ypos)", },
["glfwGetMouseWheel"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(void)", },
["glfwSetMouseWheel"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(int pos)", },
["glfwSetKeyCallback"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(GLFWkeyfun cbfun)", },
["glfwSetCharCallback"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(GLFWcharfun cbfun)", },
["glfwSetMouseButtonCallback"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(GLFWmousebuttonfun cbfun)", },
["glfwSetMousePosCallback"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(GLFWmouseposfun cbfun)", },
["glfwSetMouseWheelCallback"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(GLFWmousewheelfun cbfun)", },
["glfwGetJoystickParam"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(int joy, int param)", },
["glfwGetJoystickPos"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(int joy, float *pos, int numaxes)", },
["glfwGetJoystickButtons"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(int joy, unsigned char *buttons, int numbuttons)", },
["glfwGetTime"] = { type ='function',
description = "",
returns = "(double)",
valuetype = nil,
args = "(void)", },
["glfwSetTime"] = { type ='function',
description = "",
returns = "(void)",
valuetype = nil,
args = "(double time)", },
["glfwSleep"] = { type ='function',
description = "",
returns = "(void)",
valuetype = nil,
args = "(double time)", },
["glfwExtensionSupported"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(const char *extension)", },
["glfwGetProcAddress"] = { type ='function',
description = "",
returns = "(void*)",
valuetype = nil,
args = "(const char *procname)", },
["glfwGetGLVersion"] = { type ='function',
description = "",
returns = "(void)",
valuetype = nil,
args = "(int *major, int *minor, int *rev)", },
["glfwCreateThread"] = { type ='function',
description = "",
returns = "(GLFWthread)",
valuetype = nil,
args = "(GLFWthreadfun fun, void *arg)", },
["glfwDestroyThread"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(GLFWthread ID)", },
["glfwWaitThread"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(GLFWthread ID, int waitmode)", },
["glfwGetThreadID"] = { type ='function',
description = "",
returns = "(GLFWthread)",
valuetype = nil,
args = "(void)", },
["glfwCreateMutex"] = { type ='function',
description = "",
returns = "(GLFWmutex)",
valuetype = nil,
args = "(void)", },
["glfwDestroyMutex"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(GLFWmutex mutex)", },
["glfwLockMutex"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(GLFWmutex mutex)", },
["glfwUnlockMutex"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(GLFWmutex mutex)", },
["glfwCreateCond"] = { type ='function',
description = "",
returns = "(GLFWcond)",
valuetype = nil,
args = "(void)", },
["glfwDestroyCond"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(GLFWcond cond)", },
["glfwWaitCond"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(GLFWcond cond, GLFWmutex mutex, double timeout)", },
["glfwSignalCond"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(GLFWcond cond)", },
["glfwBroadcastCond"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(GLFWcond cond)", },
["glfwGetNumberOfProcessors"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(void)", },
["glfwEnable"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(int token)", },
["glfwDisable"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(int token)", },
["glfwReadImage"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(const char *name, GLFWimage *img, int flags)", },
["glfwReadMemoryImage"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(const void *data, long size, GLFWimage *img, int flags)", },
["glfwFreeImage"] = { type ='function',
description = "",
returns = "()",
valuetype = nil,
args = "(GLFWimage *img)", },
["glfwLoadTexture2D"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(const char *name, int flags)", },
["glfwLoadMemoryTexture2D"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(const void *data, long size, int flags)", },
["glfwLoadTextureImage2D"] = { type ='function',
description = "",
returns = "(int)",
valuetype = nil,
args = "(GLFWimage *img, int flags)", },
["GLFWvidmode"] = { type ='class',
description = "",
childs = {
["Width"] = { type ='value', description = "int", valuetype = nil, },
["Height"] = { type ='value', description = "int", valuetype = nil, },
["RedBits"] = { type ='value', description = "int", valuetype = nil, },
["BlueBits"] = { type ='value', description = "int", valuetype = nil, },
["GreenBits"] = { type ='value', description = "int", valuetype = nil, },
}
},
["GLFWimage"] = { type ='class',
description = "",
childs = {
["Width"] = { type ='value', description = "int", valuetype = nil, },
["Height"] = { type ='value', description = "int", valuetype = nil, },
["Format"] = { type ='value', description = "int", valuetype = nil, },
["BytesPerPixel"] = { type ='value', description = "int", valuetype = nil, },
}
},
}
return {
glfw = {
type = 'lib',
description = "GLFW window manager",
childs = api,
},
}

View File

@@ -7,7 +7,7 @@ return {
local bottomnotebook = ide.frame.bottomnotebook
bottomnotebook:SetSelection(1)
ShellExecuteCode(wfilename)
ShellExecuteFile(wfilename)
end,
fprojdir = function(self,wfilename)
return wfilename:GetPath(wx.wxPATH_GET_VOLUME)

View File

@@ -6,7 +6,7 @@ end
return {
name = "Luxinia2",
description = "Luxinia2",
api = {"baselib","cg30","cggl30","glfw3","glewgl","assimp20","luxmath","luxgfx","luxscene","luajit2",},
api = {"baselib","cg30","cggl30","glfw","glewgl","assimp20","luxmath","luxgfx","luxscene","luajit2",},
finitclient = function(self)
if (not CommandLineRunning(self:fuid(wfilename))) then return end

View File

@@ -112,13 +112,6 @@ return {
line = line+1
end
if (added) then
DisplayOutput("\nTYPES\n")
for i,v in pairs(assigns) do
DisplayOutput(i,v,"\n")
end
end
return assigns
end,

437
spec/ptx.lua Normal file
View File

@@ -0,0 +1,437 @@
-- author: Christoph Kubisch
---------------------------------------------------------
return {
exts = {"ptx",},
lexer = wxstc.wxSTC_LEX_CPP,
apitype = "ptx",
sep = "%.",
linecomment = "//",
isfndef = function(str)
local l
local s,e,cap = string.find(str,"^%s*([A-Za-z0-9_]+%s+[A-Za-z0-9_]+%s*%(.+%))")
if (not s) then
s,e,cap = string.find(str,"^%s*([A-Za-z0-9_]+%s+[A-Za-z0-9_]+)%s*%(")
end
if (cap and (string.find(cap,"^return") or string.find(cap,"else"))) then return end
return s,e,cap,l
end,
lexerstyleconvert = {
text = {wxstc.wxSTC_C_IDENTIFIER,
wxstc.wxSTC_C_VERBATIM,
wxstc.wxSTC_C_REGEX,
wxstc.wxSTC_C_REGEX,
wxstc.wxSTC_C_GLOBALCLASS,},
lexerdef = {wxstc.wxSTC_C_DEFAULT,},
comment = {wxstc.wxSTC_C_COMMENT,
wxstc.wxSTC_C_COMMENTLINE,
wxstc.wxSTC_C_COMMENTDOC,
wxstc.wxSTC_C_COMMENTLINEDOC,
wxstc.wxSTC_C_COMMENTDOCKEYWORD,
wxstc.wxSTC_C_COMMENTDOCKEYWORDERROR,},
stringtxt = {wxstc.wxSTC_C_STRING,
wxstc.wxSTC_C_CHARACTER,
wxstc.wxSTC_C_UUID,},
stringeol = {wxstc.wxSTC_C_STRINGEOL,},
preprocessor= {wxstc.wxSTC_C_PREPROCESSOR,},
operator = {wxstc.wxSTC_C_OPERATOR,},
number = {wxstc.wxSTC_C_NUMBER,
wxstc.wxSTC_C_WORD},
keywords0 = {wxstc.wxSTC_C_WORD,},
keywords1 = {wxstc.wxSTC_C_WORD2,},
},
keywords = {
[[
version
target
address_size
entry
func
branchtargets
calltargets
callprototype
maxnreg
maxntid
reqntid
minnctapersm
maxnctapersm
pragma
section
file
loc
extern
visible
pragma
align
file
maxntid
shared
branchtargets
func
minnctapersm
sreg
callprototype
global
param
target
calltargets
local
pragma
tex
const
loc
reg
version
entry
maxnctapersm
reqntid
visible
extern
maxnreg
section
s8
s16
s32
s64
u8
u16
u32
u64
f16
f32
f64
b8
b16
b32
b64
pred
rn
rz
rm
rp
rni
rzi
rmi
rpi
ca
cg
cs
lu
cv
wb
cg
cs
wt
texref
samplerref
surfref
sat
ftz
cc
hi
lo
wide
f4e
b4e
rc8
ecl
ecr
rc16
finite
infinite
number
notanumber
normal
subnormal
approx
full
eq
ne
lt
le
gt
ge
equ
neu
ltu
leu
gtu
geu
num
nan
ls
hs
volatile
v2
v4
L1
L2
1d
2d
3d
a1d
a2d
width
height
depth
channel_data_type
channel_order
normalized_coords
force_unnormalized_coords
filter_mode
addr_mode_0
addr_mode_1
addr_mode_2
trap
clamp
zero
all
any
uni
ballot
sync
arrive
red
cta
gl
sys
and
or
xor
cas
exch
add
inc
dec
min
max
b0
b1
b2
b3
h0
h1
wrap
shr7
shr15
byte
4byte
quad
4byte
quad
b8
b32
b64
b32
b64
]],
-- functions
[[
add
sub
add.cc
addc
sub.cc
subc
mul
mad
mul24
mad24
sad
div
rem
abs
neg
min
max
popc
clz
bfind
brev
bfe
bfi
prmt
rcp
sqrt
rsqrt
sin
cos
lg2
ex2
fma
set
setp
selp
slct
and
or
xor
not
cnot
shl
shr
mov
ld
ldu
st
prefetch
prefetchu
isspacep
cvta
cvt
tex
tld4
txq
suld
sust
sured
suq
bra
call
ret
exit
bar
membar
atom
red
vote
vadd
vsub
vabsdiff
vmin
vmax
vshl
vshr
vmad
vset
trap
brkpt
pmevent
%clock
%laneid
%lanemask_gt
%pm0
%pm1
%pm2
%pm3
%clock64
%lanemask_eq
%nctaid
%smid
%ctaid
%lanemask_le
%ntid
%tid
%envreg0
%envreg1
%envreg2
%envreg3
%envreg4
%envreg5
%envreg6
%envreg7
%envreg8
%envreg9
%envreg10
%envreg11
%envreg12
%envreg13
%envreg14
%envreg15
%envreg16
%envreg17
%envreg18
%envreg19
%envreg20
%envreg21
%envreg22
%envreg23
%envreg24
%envreg25
%envreg26
%envreg27
%envreg28
%envreg29
%envreg30
%envreg31
%lanemask_lt
%nsmid
%warpid
%gridid
%lanemask_ge
%nwarpid
WARP_SZ
nearest
linear
wrap
mirror
clamp_ogl
clamp_to_edge
clamp_to_border
sm_20
sm_10
sm_11
sm_12
sm_13
texmode_unified
texmode_independent
map_f64_to_f32
]],
},
}

View File

@@ -13,7 +13,7 @@
-- style definition
-- ----------------------------------------------------
-- all entries are optiona
-- all entries are optional
stattr = {
fg = {r,g,b}, -- foreground color 0-255
bg = {r,g,b}, -- background color
@@ -21,6 +21,13 @@ stattr = {
b = false, -- bold
u = false, -- underline
fill = true, -- fill to lineend
-- fn = "Lucida Console", -- font Face Name
-- fx = 11, -- font size
-- hs = true or {r,g,b}, -- turn hotspot on
-- use the specified color as activeForeground
-- use "hs = true", to turn it on without changing the color
-- HotspotActiveUnderline and HotspotSingleLine are on automatically
-- v = true, -- visibility for symbols of the current style
}
style = {

View File

@@ -117,7 +117,7 @@ function OpenFile(event)
if fileDialog:ShowModal() == wx.wxID_OK then
if not LoadFile(fileDialog:GetPath(), nil, true) then
wx.wxMessageBox("Unable to load file '"..fileDialog:GetPath().."'.",
"wxLua Error",
"Error",
wx.wxOK + wx.wxCENTRE, ide.frame)
end
end
@@ -129,8 +129,6 @@ function SaveFile(editor, filePath)
if not filePath then
return SaveFileAs(editor)
else
filePath = filePath:gsub("\\","/")
if (ide.config.savebak) then
local backPath = filePath..".bak"
os.remove(backPath)
@@ -156,7 +154,7 @@ function SaveFile(editor, filePath)
return true
else
wx.wxMessageBox("Unable to save file '"..filePath.."'.",
"wxLua Error Saving",
"Error",
wx.wxOK + wx.wxCENTRE, ide.frame)
end
end
@@ -190,6 +188,7 @@ function SaveFileAs(editor)
if SaveFile(editor, filePath) then
SetupKeywords(editor, GetFileExt(filePath))
IndicateFunctions(editor)
if MarkupStyle then MarkupStyle(editor) end
saved = true
end
end
@@ -218,7 +217,10 @@ local function removePage(index)
selectIndex = selectIndex ~= index and selectIndex
local delid = nil
for id, document in pairs(openDocuments) do
for id, document in pairsSorted(openDocuments,
function(a, b) -- sort by document index
return openDocuments[a].index < openDocuments[b].index
end) do
local wasselected = document.index == selectIndex
if document.index < index then
prevIndex = document.index
@@ -271,12 +273,7 @@ function SaveModifiedDialog(editor, allow_cancel)
local filePath = document.filePath
local fileName = document.fileName
if document.isModified then
local message
if fileName then
message = "Save changes to '"..fileName.."' before exiting?"
else
message = "Save changes to 'untitled' before exiting?"
end
local message = "Do you want to save the changes to '"..(fileName or 'untitled').."'?"
local dlg_styles = wx.wxYES_NO + wx.wxCENTRE + wx.wxICON_QUESTION
if allow_cancel then dlg_styles = dlg_styles + wx.wxCANCEL end
local dialog = wx.wxMessageDialog(ide.frame, message,

View File

@@ -97,7 +97,9 @@ debugger.listen = function()
local options = debugger.options or {}
local wxfilepath = GetEditorFileAndCurInfo()
local startfile = options.startfile or wxfilepath:GetFullPath()
local basedir = options.basedir or wxfilepath:GetPath(wx.wxPATH_GET_VOLUME)
local basedir = options.basedir
or FileTreeGetDir()
or wxfilepath:GetPath(wx.wxPATH_GET_VOLUME + wx.wxPATH_GET_SEPARATOR)
debugger.basedir = basedir
debugger.server = copas.wrap(skt)
debugger.socket = skt
@@ -124,7 +126,8 @@ debugger.listen = function()
end
if (options.run) then
activateDocument(debugger.handle("run"))
local file, line = debugger.handle("run")
activateDocument(file, line)
else
local file, line = debugger.handle("load " .. startfile)
-- "load" can work in two ways: (1) it can load the requested file
@@ -139,23 +142,23 @@ debugger.listen = function()
else
-- try to find a proper file based on file name
-- first check using basedir that was set based on current file path
-- if not found, check using project directory and reset basedir
if not activated then
local fullPath = debugger.basedir..string_Pathsep..file
activated = activateDocument(fullPath, line)
activated = activateDocument(debugger.basedir..file, line)
end
local projectDir = FileTreeGetDir()
if not activated and projectDir then
debugger.basedir = projectDir:gsub(string_Pathsep .. "$", "")
debugger.handle("basedir " .. debugger.basedir)
fullPath = projectDir .. file
activated = activateDocument(fullPath, line)
-- if not found, check using full file path and reset basedir
if not activated then
local path = wxfilepath:GetPath(wx.wxPATH_GET_VOLUME + wx.wxPATH_GET_SEPARATOR)
activated = activateDocument(path..file, line)
if activated then
debugger.basedir = path
debugger.handle("basedir " .. debugger.basedir)
end
end
end
if not activated then
DisplayOutput("Can't find file '" .. file .. "' to activate for debugging; try opening the file before debugging.\n")
DisplayOutput("Can't find file '" .. file .. "' to activate for debugging; open the file before debugging.\n")
return debugger.terminate()
end
else
@@ -202,7 +205,7 @@ debugger.exec = function(command)
return
else
if debugger.basedir and not wx.wxIsAbsolutePath(file) then
file = debugger.basedir .. "/" .. file
file = debugger.basedir .. file
end
if activateDocument(file, line) then
if debugger.loop then

View File

@@ -118,10 +118,10 @@ end
-- ----------------------------------------------------------------------------
-- Get/Set notebook editor page, use nil for current page, returns nil if none
function GetEditor(selection)
local editor = nil
if selection == nil then
selection = notebook:GetSelection()
end
local editor
if (selection >= 0) and (selection < notebook:GetPageCount()) and (notebook:GetPage(selection):GetClassInfo():GetClassName()=="wxStyledTextCtrl") then
editor = notebook:GetPage(selection):DynamicCast("wxStyledTextCtrl")
end
@@ -214,10 +214,8 @@ function CreateEditor(name)
if (ide.config.editor.usewrap) then
editor:SetWrapMode(wxstc.wxSTC_WRAP_WORD)
editor:SetWrapStartIndent(2)
editor:SetWrapStartIndent(0)
editor:SetWrapVisualFlagsLocation(wxstc.wxSTC_WRAPVISUALFLAGLOC_END_BY_TEXT)
editor:SetWrapVisualFlags(wxstc.wxSTC_WRAPVISUALFLAG_START)
editor:WrapCount(80)
end
editor:SetCaretLineVisible(ide.config.editor.caretline and 1 or 0)
@@ -379,10 +377,22 @@ function CreateEditor(name)
for e,iv in ipairs(editor.ev) do
local line = editor:LineFromPosition(iv[1])
IndicateFunctions(editor,line,line+iv[2])
if MarkupStyle then MarkupStyle(editor,line,line+iv[2]) end
end
editor.ev = {}
end)
editor:Connect(wx.wxEVT_LEFT_DOWN,
function (event)
if MarkupHotspotClick then
local position = editor:PositionFromPointClose(event:GetX(),event:GetY())
if position ~= wx.wxSTC_INVALID_POSITION then
if MarkupHotspotClick(position, editor) then return end
end
end
event:Skip()
end)
editor:Connect(wx.wxEVT_SET_FOCUS,
function (event)
event:Skip()
@@ -392,13 +402,6 @@ function CreateEditor(name)
ide.in_evt_focus = false
end)
--[[
editor:Connect(wxstc.wxEVT_STC_POSCHANGED,
function (event)
-- brace checking
end)
]]
if notebook:AddPage(editor, name, true) then
local id = editor:GetId()
local document = {}
@@ -441,8 +444,6 @@ end
function IndicateFunctions(editor, lines, linee)
if (not (edcfg.showfncall and editor.spec and editor.spec.isfncall)) then return end
--DisplayOutput("indicate: "..tostring(lines).." "..tostring(linee).."\n")
local es = editor:GetEndStyled()
local lines = lines or 0
local linee = linee or editor:GetLineCount()-1
@@ -480,15 +481,8 @@ function IndicateFunctions(editor, lines, linee)
if (f) then
local p = ls+f+off
local s = bit.band(editor:GetStyleAt(p),31)
if (not (isinvalid[s])) then
editor:StartStyling(p,INDICS_MASK)
editor:SetStyling(t-f,INDIC0_MASK + 1)
else
editor:StartStyling(p,INDICS_MASK)
editor:SetStyling(t-f,0)
end
editor:StartStyling(p,INDICS_MASK)
editor:SetStyling(t-f,isinvalid[s] and 0 or (INDIC0_MASK + 1))
off = off + t
end
from = t and (t+1)
@@ -500,7 +494,6 @@ end
function SetupKeywords(editor, ext, forcespec, styles, font, fontitalic)
local lexerstyleconvert = nil
local spec = forcespec or GetSpec(ext)
--print(ext..":"..tostring(spec.apitype))
-- found a spec setup lexers and keywords
if spec then
editor:SetLexer(spec.lexer or wxstc.wxSTC_LEX_NULL)

View File

@@ -287,8 +287,7 @@ projpanel.projcombobox = projcombobox
projpanel.projtree = projtree
function FileTreeGetDir()
-- atm only projtree
return projpanel:IsShown() and (filetree.newfiledir .. string_Pathsep)
return projpanel:IsShown() and filetree.newfiledir
end
function FileTreeSetProjects(tab)
@@ -306,7 +305,7 @@ local function findItem(tree, match)
local node = projtree:GetRootItem()
local label = tree:GetItemText(node)
local s, e = string.find(match, label .. string_Pathsep)
local s, e = string.find(match, label)
if not s or s ~= 1 then return end
for token in string.gmatch(string.sub(match,e+1), "[^%"..string_Pathsep.."]+") do

View File

@@ -44,7 +44,10 @@ ide.ofontItalic = ofontItalic
local function createFrame()
frame = wx.wxFrame(wx.NULL, wx.wxID_ANY, GetIDEString("editor"),
wx.wxDefaultPosition, wx.wxSize(1000, 700))
frame:DragAcceptFiles(true)
-- wrap into protected call as DragAcceptFiles fails on MacOS with
-- wxwidgets 2.8.12 even though it should work according to change notes
-- for 2.8.10: "Implemented wxWindow::DragAcceptFiles() on all platforms."
pcall(function() frame:DragAcceptFiles(true) end)
frame:Connect(wx.wxEVT_DROP_FILES,function(evt)
local files = evt:GetFiles()
if not files or #files == 0 then return end

159
src/editor/markup.lua Normal file
View File

@@ -0,0 +1,159 @@
-- Copyright (C) Paul Kulchenko 2011-2012
-- update styles for comment markup
local styles = ide.config.styles
local comment = styles.comment
local MD_MARK_ITAL = '_' -- italic
local MD_MARK_BOLD = '*' -- bold
local MD_MARK_LINK = '~' -- link
local MD_MARK_HEAD = '!' -- header
local MD_MARK_CODE = '@' -- code
local MD_MARK_BOXD = '|' -- highlight
local MD_MARK_LSEP = ';' -- link separator (between text and link)
local MD_MARK_MARK = ' ' -- separator
local MD_LINK_NEWWINDOW = '+' -- indicator to open a new window for links
local markup = {
[MD_MARK_BOXD] = {st=25, fg={127,0,127}, bg=comment.bg, b=true},
[MD_MARK_CODE] = {st=26, fg={127,127,127}, bg=comment.bg, fs=9},
[MD_MARK_HEAD] = {st=27, fg=comment.fg, bg=comment.bg, fn="Lucida Console", b=true},
[MD_MARK_LINK] = {st=28, fg=comment.fg, bg=comment.bg, u=true, hs={0, 0, 127}},
[MD_MARK_BOLD] = {st=29, fg=comment.fg, bg=comment.bg, b=true, fs=11},
[MD_MARK_ITAL] = {st=30, fg=comment.fg, bg=comment.bg, i=true},
[MD_MARK_MARK] = {st=31, fg=comment.fg, bg=comment.bg, v=false},
}
local MD_MARK_PTRN = '' -- combination of all markup marks that can start styling
for key,value in pairs(markup) do
styles[key] = value
if key ~= MD_MARK_MARK then MD_MARK_PTRN = MD_MARK_PTRN .. "%" .. key end
end
function MarkupHotspotClick(pos, editor)
-- check if this is "our" hotspot event
if bit.band(editor:GetStyleAt(pos),31) ~= markup[MD_MARK_LINK].st then
-- not "our" style, so nothing to do for us here
return
end
local line = editor:LineFromPosition(pos)
local tx = editor:GetLine(line)
pos = pos + 1 - editor:PositionFromLine(line) -- turn into relative position
-- find the separator on the right side of the position
local poss = string.find(tx, MD_MARK_LSEP, pos, true)
local pose = string.find(tx, MD_MARK_LINK, pos, true)
if (poss and pose) then
local text = string.sub(tx, poss+1, pose-1)
local filepath = ide.openDocuments[editor:GetId()].filePath
local _,_,shell = string.find(text, [[^macro:shell%((.*%S)%)$]])
local _,_,http = string.find(text, [[^(http:%S+)$]])
local _,_,command = string.find(text, [[^macro:(%w+)$]])
local bottomnotebook = ide.frame.bottomnotebook
if shell then
local index = bottomnotebook:GetPageIndex(bottomnotebook.shellbox)
if index then bottomnotebook:SetSelection(index) end
ShellExecuteCode(shell)
elseif command == 'run' then -- run the current file
local index = bottomnotebook:GetPageIndex(bottomnotebook.errorlog)
if index then bottomnotebook:SetSelection(index) end
ProjectRun()
elseif command == 'debug' then -- debug the current file
local index = bottomnotebook:GetPageIndex(bottomnotebook.errorlog)
if index then bottomnotebook:SetSelection(index) end
ProjectDebug()
elseif http then -- open the URL in a new browser window
wx.wxLaunchDefaultBrowser(http, 0)
else
-- check if requested to open in a new window
local newwindow = string.find(text, MD_LINK_NEWWINDOW, 1, true) -- plain search
if newwindow then text = string.gsub(text, "^%" .. MD_LINK_NEWWINDOW, "") end
local name = wx.wxFileName(filepath):GetPath(wx.wxPATH_GET_VOLUME
+ wx.wxPATH_GET_SEPARATOR) .. text
-- load/activate file
local filename = wx.wxFileName(name)
filename:Normalize() -- remove .., ., and other similar elements
if filename:FileExists() and
(newindow or SaveModifiedDialog(editor, true) ~= wx.wxID_CANCEL) then
LoadFile(filename,not newwindow and editor or nil,true)
end
end
end
return true
end
local function ismarkup (tx)
local start = 1
while true do
-- find a separator first
local st,_,sep = string.find(tx, "(["..MD_MARK_PTRN.."])", start)
if not st then return end
local s,e,cap
if sep == MD_MARK_HEAD then
s,e,cap = string.find(tx,"^(%"..MD_MARK_HEAD..".+[%w%p])", start)
elseif sep == MD_MARK_LINK then
local any = "[^%"..MD_MARK_LINK.."%"..MD_MARK_LSEP.."]-"
s,e,cap = string.find(tx,"^(%"..MD_MARK_LINK.."[%w%p]"..any.."[%w%p]"..
"%"..MD_MARK_LSEP.."[%w%p]"..any.."[%w%p]"..
"%"..MD_MARK_LINK..")", st)
else
s,e,cap = string.find(tx,"^(%"..sep.."[%w%p][^%"..sep.."]-[%w%p]%"..sep..")", st)
if not s then s,e,cap = string.find(tx,"^(%"..sep.."[^%s%"..sep.."]%"..sep..")", st) end
end
if s then return s,e,cap,sep end
start = st+1
end
end
function MarkupStyle(editor, lines, linee)
local lines = lines or 0
if (lines < 0) then return end
-- always style to the end as there may be comments that need re-styling
-- technically, this should be GetLineCount()-1, but we want to style
-- beyond the last line to make sure it is styled correctly
local linee = linee or editor:GetLineCount()-1
local linef = editor:GetLineCount()
local iscomment = {}
for i,v in pairs(editor.spec.iscomment) do
iscomment[i] = v
end
for line=lines,linef do
local tx = editor:GetLine(line)
local ls = editor:PositionFromLine(line)
editor:StartStyling(ls, 0)
local from = 1
local off = -1
while from do
tx = string.sub(tx,from)
local f,t,w,mark = ismarkup(tx)
if (f) then
local p = ls+f+off
local s = bit.band(editor:GetStyleAt(p), 31)
if iscomment[s] then
editor:StartStyling(p, 31)
editor:SetStyling(1, markup[MD_MARK_MARK].st)
local endmark = 1
if mark == MD_MARK_HEAD then
endmark = 0
elseif mark == MD_MARK_LINK then
local pipe = w:find(MD_MARK_LSEP)
if pipe then
endmark = #w-pipe+1
end
end
editor:SetStyling(t-f-endmark, markup[mark].st or markup[MD_MARK_MARK].st)
editor:SetStyling(endmark, markup[MD_MARK_MARK].st)
end
off = off + t
end
from = t and (t+1)
end
end
end

View File

@@ -99,7 +99,10 @@ frame:Connect(ID_SAVEALL, wx.wxEVT_UPDATE_UI,
event:Enable(atLeastOneModifiedDocument)
end)
frame:Connect(ID_CLOSE, wx.wxEVT_COMMAND_MENU_SELECTED, ClosePage)
frame:Connect(ID_CLOSE, wx.wxEVT_COMMAND_MENU_SELECTED,
function (event)
ClosePage() -- this will find the current editor
end)
frame:Connect(ID_CLOSE, wx.wxEVT_UPDATE_UI,
function (event)
event:Enable((GetEditor() ~= nil) and (debugger.server == nil))

View File

@@ -39,7 +39,6 @@ do
targetMenu = wx.wxMenu(targetargs)
end
local debugTab = {
{ ID_RUN, "&Run\tF6", "Execute the current project/file" },
{ ID_COMPILE, "&Compile\tF7", "Test compile the Lua file" },
@@ -184,6 +183,21 @@ local function runInterpreter(wfilename, withdebugger)
if withdebugger then debugger.pid = pid end
end
function ProjectRun()
runInterpreter(getNameToRun())
end
function ProjectDebug()
if (debugger.server ~= nil) then
if (not debugger.running) then
ClearAllCurrentLineMarkers()
debugger.run()
end
else
runInterpreter(getNameToRun(), true)
end
end
-----------------------
-- Actions
@@ -210,10 +224,7 @@ frame:Connect(ID_COMPILE, wx.wxEVT_UPDATE_UI,
event:Enable((debugger.server == nil) and (editor ~= nil))
end)
frame:Connect(ID_RUN, wx.wxEVT_COMMAND_MENU_SELECTED,
function (event)
runInterpreter(getNameToRun())
end)
frame:Connect(ID_RUN, wx.wxEVT_COMMAND_MENU_SELECTED, ProjectRun)
frame:Connect(ID_RUN, wx.wxEVT_UPDATE_UI,
function (event)
local editor = GetEditor()
@@ -233,17 +244,7 @@ frame:Connect(ID_ATTACH_DEBUG, wx.wxEVT_UPDATE_UI,
end)
local lastcontinue
frame:Connect(ID_START_DEBUG, wx.wxEVT_COMMAND_MENU_SELECTED,
function (event)
if (debugger.server ~= nil) then
if (not debugger.running) then
ClearAllCurrentLineMarkers()
debugger.run()
end
else
runInterpreter(getNameToRun(), true)
end
end)
frame:Connect(ID_START_DEBUG, wx.wxEVT_COMMAND_MENU_SELECTED, ProjectDebug)
frame:Connect(ID_START_DEBUG, wx.wxEVT_UPDATE_UI,
function (event)
local editor = GetEditor()

View File

@@ -26,10 +26,9 @@ out:SetViewWhiteSpace(ide.config.editor.whitespace and true or false)
out:SetIndentationGuides(true)
out:SetWrapMode(wxstc.wxSTC_WRAP_WORD)
out:SetWrapStartIndent(2)
out:SetWrapStartIndent(0)
out:SetWrapVisualFlagsLocation(wxstc.wxSTC_WRAPVISUALFLAGLOC_END_BY_TEXT)
out:SetWrapVisualFlags(wxstc.wxSTC_WRAPVISUALFLAG_START)
out:WrapCount(80)
out:SetWrapVisualFlags(wxstc.wxSTC_WRAPVISUALFLAG_END)
out:MarkerDefine(CURRENT_LINE_MARKER, wxstc.wxSTC_MARK_CHARACTER+string.byte('>'), wx.wxBLACK, wx.wxColour(240, 240, 240))
out:MarkerDefine(BREAKPOINT_MARKER, wxstc.wxSTC_MARK_BACKGROUND, wx.wxBLACK, wx.wxColour(255, 220, 220))
@@ -137,6 +136,7 @@ local function shellPrint(marker, ...)
out:EmptyUndoBuffer() -- don't allow the user to undo shell text
out:GotoPos(out:GetLength())
out:EnsureVisibleEnforcePolicy(out:GetLineCount()-1)
end
DisplayShell = function (...)
@@ -238,7 +238,6 @@ local env = createenv()
local function executeShellCode(tx)
if tx == nil or tx == '' then return end
DisplayShellDirect('\n')
DisplayShellPrompt('')
local addedret = false
@@ -260,10 +259,22 @@ local function executeShellCode(tx)
DisplayShellErr(err)
elseif fn then
setfenv(fn,env)
-- set the project dir as the current dir to allow "require" calls
-- to work from shell
local projectDir, cwd = FileTreeGetDir()
if projectDir then
cwd = wx.wxFileName.GetCwd()
wx.wxFileName.SetCwd(projectDir)
end
local ok, res = xpcall(fn,
function(err)
DisplayShellErr(filterTraceError(debug.traceback(err), addedret))
end)
-- restore the current dir
if projectDir then wx.wxFileName.SetCwd(cwd) end
if ok and (addedret or res ~= nil) then DisplayShell(res) end
end
@@ -272,18 +283,25 @@ end
function ShellSupportRemote(client,uid)
remotesend = client
-- change the name of the tab: console is the second page in the notebook
bottomnotebook:SetPageText(1,
client and "Remote console" or "Local console")
local index = bottomnotebook:GetPageIndex(out)
if index then
bottomnotebook:SetPageText(index,
client and "Remote console" or "Local console")
end
end
function ShellExecuteCode(wfilename)
function ShellExecuteFile(wfilename)
if (not wfilename) then return end
local cmd = 'dofile([['..wfilename:GetFullPath()..']])'
DisplayShellDirect(cmd)
executeShellCode(cmd)
end
function ShellExecuteCode(code)
DisplayShellDirect(code)
executeShellCode(code)
end
local function displayShellIntro()
DisplayShellDirect([[Welcome to the interactive Lua interpreter.
Enter Lua code and press Enter to run it. Use Shift-Enter for multiline code.
@@ -350,6 +368,7 @@ out:Connect(wx.wxEVT_KEY_DOWN,
out:ClearAll()
displayShellIntro()
else
DisplayShellDirect('\n')
executeShellCode(promptText)
end
currentHistory = getPromptLine() -- reset history

View File

@@ -11,6 +11,10 @@
-- b bold - boolean
-- i italic - boolean
-- fill fill to end - boolean
-- fn font Face Name - string ("Lucida Console")
-- fx font size - number (11)
-- hs turn hotspot on - true or {r,g,b} 0-255
-- v visibility for symbols of the current style - boolean
function StylesGetDefault()
return {
@@ -148,6 +152,21 @@ function StylesApplyToEditor(styles,editor,font,fontitalic,lexerconvert)
editor:StyleSetUnderline(id, style.u or false)
editor:StyleSetEOLFilled(id, style.fill or false)
if style.fn then editor:StyleSetFaceName(id, style.fn) end
if style.fs then editor:StyleSetSize(id, style.fs) end
if style.v ~= nil then editor:StyleSetVisible(id, style.v) end
if style.hs then
editor:StyleSetHotSpot(id, 1)
-- if passed a color (table) as value, set it as foreground
if type(style.hs) == 'table' then
local color = wx.wxColour(unpack(style.hs))
editor:SetHotspotActiveForeground(1, color)
end
editor:SetHotspotActiveUnderline(1)
editor:SetHotspotSingleLine(1)
end
if (style.fg or defaultfg) then
editor:StyleSetForeground(id, style.fg and wx.wxColour(unpack(style.fg)) or defaultfg)
end
@@ -179,6 +198,10 @@ function StylesApplyToEditor(styles,editor,font,fontitalic,lexerconvert)
for n,outid in pairs(targets) do
applystyle(style,outid)
end
-- allow to specify style numbers, but exclude those styles
-- that may conflict with indicator numbers
elseif (style.st and style.st > 8 and style.st < wxstc.wxSTC_STYLE_DEFAULT) then
applystyle(style,style.st)
end
end
@@ -222,7 +245,7 @@ function LoadConfigStyle()
if not (cfgfn and (cfg.styles or cfg.stylesoutshell)) then
wx.wxMessageBox("Unable to load config style '"..fileDialog:GetPath().."'.",
"wxLua Error",
"Error",
wx.wxOK + wx.wxCENTRE, ide.frame)
else
if (cfg.styles) then

View File

@@ -173,3 +173,17 @@ function FileSysGet(dir,spec)
end
return content
end
function pairsSorted(t, f)
local a = {}
for n in pairs(t) do table.insert(a, n) end
table.sort(a, f)
local i = 0 -- iterator variable
local iter = function () -- iterator function
i = i + 1
if a[i] == nil then return nil
else return a[i], t[a[i]]
end
end
return iter
end

View File

@@ -15,6 +15,7 @@ return dxpath and {
{ },
{ ID "dx.compile.input", "&Custom Args", "when set a popup for custom compiler args will be envoked", wx.wxITEM_CHECK },
{ ID "dx.compile.legacy", "&Legacy", "when set compiles in legacy mode", wx.wxITEM_CHECK },
{ ID "dx.compile.backwards", "&Backwards Compatibility", "when set compiles in backwards compatibility mode", wx.wxITEM_CHECK },
{ },
{ ID "dx.compile.vertex", "Compile &Vertex", "Compile Vertex shader (select entry word)" },
{ ID "dx.compile.fragment", "Compile &Fragment", "Compile pixel shader (select entry word)" },
@@ -26,7 +27,9 @@ return dxpath and {
local data = {}
data.customarg = false
data.custom = ""
data.legacy = false
data.backwards = false
data.profid = ID ("dx.profile."..dxprofile)
data.domains = {
[ID "dx.compile.vertex"] = 1,
@@ -77,6 +80,10 @@ return dxpath and {
function(event)
data.legacy = event:IsChecked()
end)
frame:Connect(ID "dx.compile.backwards",wx.wxEVT_COMMAND_MENU_SELECTED,
function(event)
data.backwards = event:IsChecked()
end)
-- Compile
local function evCompile(event)
local filename,info = GetEditorFileAndCurInfo()
@@ -92,19 +99,20 @@ return dxpath and {
if (not profile[domain]) then return end
-- popup for custom input
local args = data.customarg and wx.wxGetTextFromUser("Compiler Args") or ""
args = args:len() > 0 and args or nil
data.custom = data.customarg and wx.wxGetTextFromUser("Compiler Args","Dx",data.custom) or data.custom
local args = data.custom:len() > 0 and data.custom or nil
local fullname = filename:GetFullPath()
local outname = fullname.."."..info.selword.."^"
outname = args and outname..args:gsub("%s+%-",";-")..";^" or outname
outname = args and outname..args:gsub("%s*[%-%/]",";-")..";^" or outname
outname = outname..profile[domain]..profile.ext
outname = '"'..outname..'"'
local cmdline = " /T "..profile[domain].." "
cmdline = cmdline..(args and args.." " or "")
cmdline = cmdline..(data.legacy and "/LD " or "")
cmdline = cmdline..(data.backwards and "/Gec " or "")
cmdline = cmdline..data.domaindefs[domain]
cmdline = cmdline.."/Fc "..outname.." "
cmdline = cmdline.."/E "..info.selword.." "

View File

@@ -62,6 +62,7 @@ src/editor/findreplace.lua
src/editor/gui.lua
src/editor/ids.lua
src/editor/iofilters.lua
src/editor/markup.lua
src/editor/menu.lua
src/editor/menu_edit.lua
src/editor/menu_file.lua

View File

@@ -26,6 +26,9 @@ local app = {
wx.wxArtProvider.Push(artProvider)
ide.config.interpreter = "luadeb";
-- this needs to be in pre-init to load the styles
dofile("src/editor/markup.lua")
end,
postinit = function ()
@@ -54,6 +57,16 @@ local app = {
if itemid ~= wx.wxNOT_FOUND then menu:Destroy(itemid) end
menuBar:Check(ID_CLEAROUTPUT, true)
-- load welcome.lua from myprograms/ if exists
local fn = wx.wxFileName("myprograms/welcome.lua")
if fn:FileExists() and
(not ide.config.path.projectdir
or string.len(ide.config.path.projectdir) == 0) then
fn:Normalize() -- make absolute path
LoadFile(fn:GetFullPath(),nil,true)
ProjectUpdateProjectDir(fn:GetPath(wx.wxPATH_GET_VOLUME))
end
end,
stringtable = {

View File

@@ -12,42 +12,43 @@ singleinstance = true
singleinstanceport = 0xe493
acandtip.shorttip = true
acandtip.nodynwords = true
styles = {
-- lexer specific (inherit fg/bg from text)
lexerdef = {fg = {128, 128, 128},},
comment = {fg = {0, 127, 0 },bg = {240, 240, 220}, fill= true,},
stringtxt = {fg = {127, 0, 127},},
stringeol = {fg = {0, 0, 0 },bg = {224, 192, 224}, fill = true, },
preprocessor = {fg = {127, 127, 0 },},
operator = {fg = {0, 0, 0 },},
number = {fg = {90, 100, 0 },},
lexerdef = {fg = {128, 128, 128}},
comment = {fg = {32, 127, 32}, bg = {250, 250, 240}, fill= true},
stringtxt = {fg = {127, 0, 127}},
stringeol = {fg = {0, 0, 0}, bg = {224, 192, 224}, fill = true},
preprocessor = {fg = {127, 127,0}},
operator = {fg = {0, 0, 0}},
number = {fg = {90, 100, 0}},
keywords0 = {fg = {0, 0, 127}, b = true,},
keywords1 = {fg = {127, 0, 0}, b = true,},
keywords2 = {fg = {0, 127, 0}, b = true,},
keywords3 = {fg = {0, 0, 127}, b = true,},
keywords4 = {fg = {127, 0, 95}, b = true,},
keywords5 = {fg = {35, 95, 175}, b = true,},
keywords6 = {fg = {0, 127, 127}, b = true,},
keywords7 = {fg = {240, 255, 255}, b = true,},
keywords0 = {fg = {0, 0, 127}, b = true},
keywords1 = {fg = {127, 0, 0}, b = true},
keywords2 = {fg = {0, 127, 0}, b = true},
keywords3 = {fg = {0, 0, 127}, b = true},
keywords4 = {fg = {127, 0, 95}, b = true},
keywords5 = {fg = {35, 95, 175}, b = true},
keywords6 = {fg = {0, 127, 127}, b = true},
keywords7 = {fg = {240, 255, 255}, b = true},
-- common (inherit fg/bg from text)
text = nil, -- let os pick
linenumber = {fg = {90, 90, 80},},
linenumber = {fg = {90, 90, 80}},
bracematch = {fg = {0, 0, 255}, b = true},
bracemiss = {fg = {255, 0, 0 }, b = true},
ctrlchar = nil,
indent = {fg = {192, 192, 192},bg = {255, 255, 255},},
indent = {fg = {192, 192, 192}, bg = {255, 255, 255}},
calltip = nil,
-- common special (need custom fg & bg)
calltipbg = nil,
sel = nil,
caret = nil,
caretlinebg = nil,
caretlinebg = {bg = {250,250,240}},
fold = nil,
whitespace = nil,
fncall = {fg = {175,175,255}, st= wxstc.wxSTC_INDIC_BOX},
fncall = {fg = {175,175,255}, st= wxstc.wxSTC_INDIC_TT},
}