aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lua_interface.c3
-rw-r--r--src/textadept.c17
-rw-r--r--src/textadept.h8
3 files changed, 28 insertions, 0 deletions
diff --git a/src/lua_interface.c b/src/lua_interface.c
index 08ad97c6..8a1fc675 100644
--- a/src/lua_interface.c
+++ b/src/lua_interface.c
@@ -111,6 +111,9 @@ void l_init(int argc, char **argv, bool reinit) {
lua_getfield(lua, LUA_REGISTRYINDEX, "arg"); lua_setglobal(lua, "arg");
lua_pushstring(lua, textadept_home); lua_setglobal(lua, "_HOME");
+#ifdef WIN32
+ lua_pushboolean(lua, 1); lua_setglobal(lua, "WIN32");
+#endif
l_load_script("core/init.lua");
}
diff --git a/src/textadept.c b/src/textadept.c
index 26bce179..6872e872 100644
--- a/src/textadept.c
+++ b/src/textadept.c
@@ -2,6 +2,11 @@
#include "textadept.h"
+#ifdef WIN32
+#include "Windows.h"
+#define strcasecmp _stricmp
+#endif
+
#define signal(o, s, c) g_signal_connect(G_OBJECT(o), s, G_CALLBACK(c), 0)
// Textadept
@@ -72,6 +77,18 @@ int main(int argc, char **argv) {
return 0;
}
+#ifdef WIN32
+int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR lpCmdLine, int) {
+ // TODO: lpCmdLine contains command line string, pass to Lua
+ gtk_init(0, NULL);
+ l_init(0, NULL, false);
+ create_ui();
+ l_load_script("init.lua");
+ gtk_main();
+ return 0;
+}
+#endif
+
/**
* Creates the user interface.
* The UI consists of:
diff --git a/src/textadept.h b/src/textadept.h
index 8c858142..395a462f 100644
--- a/src/textadept.h
+++ b/src/textadept.h
@@ -26,13 +26,21 @@ extern GtkWidget
extern GtkEntryCompletion *command_entry_completion;
extern GtkTreeStore *cec_store, *pm_store;
extern lua_State *lua;
+#ifndef WIN32
static const char *textadept_home = "/usr/share/textadept/";
+#else
+static const char *textadept_home = "C:\\Program Files\\textadept";
+#endif
static long SS(ScintillaObject *sci, unsigned int msg, unsigned long wParam=0,
long lParam=0) {
return scintilla_send_message(sci, msg, wParam, lParam);
}
+#ifdef WIN32
+#define bool gboolean
+#endif
+
// textadept.c
void create_ui();
GtkWidget* new_scintilla_window(sptr_t default_id=NULL);