summaryrefslogtreecommitdiff
path: root/ldmicro/ldmicro.cpp
diff options
context:
space:
mode:
authorNatsuDrag92018-06-06 16:26:02 +0530
committerNatsuDrag92018-06-06 16:26:02 +0530
commit51184db35fe7c9b1f81b50473cb46f4b017088f9 (patch)
tree4d0ec1e58889364d8d74e90eec89dfae3a9842da /ldmicro/ldmicro.cpp
parent67b618853b13595749ef89c620de4bc8e967cd02 (diff)
downloadLDMicroGtk-51184db35fe7c9b1f81b50473cb46f4b017088f9.tar.gz
LDMicroGtk-51184db35fe7c9b1f81b50473cb46f4b017088f9.tar.bz2
LDMicroGtk-51184db35fe7c9b1f81b50473cb46f4b017088f9.zip
Updated ListStore
Diffstat (limited to 'ldmicro/ldmicro.cpp')
-rw-r--r--ldmicro/ldmicro.cpp250
1 files changed, 132 insertions, 118 deletions
diff --git a/ldmicro/ldmicro.cpp b/ldmicro/ldmicro.cpp
index 8add732..19f825c 100644
--- a/ldmicro/ldmicro.cpp
+++ b/ldmicro/ldmicro.cpp
@@ -1048,126 +1048,140 @@ static BOOL MakeWindowClass()
return RegisterClassEx(&wc);
}
-//-----------------------------------------------------------------------------
-// Entry point into the program.
-//-----------------------------------------------------------------------------
-int main(int argc, char** argv)
+int main (int argc, char *argv[])
{
- // Check if we're running in non-interactive mode; in that case we should
- // load the file, compile, and exit.
- if(argc >= 2) {
- RunningInBatchMode = TRUE;
+ GtkApplication *app;
+ int status;
+
+ app = gtk_application_new ("org.gtk.new", G_APPLICATION_FLAGS_NONE);
+ g_signal_connect (app, "activate", G_CALLBACK (Activate_App), NULL);
+ status = g_application_run (G_APPLICATION (app), argc, argv);
- char *err =
- "Bad command line arguments: run 'ldmicro /c src.ld dest.hex'";
+ g_object_unref (app);
- char *source = lpCmdLine + 2;
- while(isspace(*source)) {
- source++;
- }
- if(*source == '\0') { Error(err); exit(-1); }
- char *dest = source;
- while(!isspace(*dest) && *dest) {
- dest++;
- }
- if(*dest == '\0') { Error(err); exit(-1); }
- *dest = '\0'; dest++;
- while(isspace(*dest)) {
- dest++;
- }
- if(*dest == '\0') { Error(err); exit(-1); }
- if(!LoadProjectFromFile(source)) {
- Error("Couldn't open '%s', running non-interactively.", source);
- exit(-1);
- }
- strcpy(CurrentCompileFile, dest);
- GenerateIoList(-1);
- CompileProgram(FALSE); /// Requires an open dialog to get file name
- exit(0);
- }
+ return status;
+}
- Instance = hInstance;
-
- MainHeap = HeapCreate(0, 1024*64, 0);
-
- // MakeWindowClass();
- // MakeDialogBoxClass();
- // MakeAdvancedDialogClass();
- // MakeAdvancedWorkspaceClass();
- // MakeComponentListClass();
- // MakeSmplDialogClass();
- // MakeNamingListClass();
- HMENU top = MakeMainWindowMenus();
-
- /// Make main window
- // MainWindow = CreateWindowEx(0, "LDmicro", "",
- // WS_OVERLAPPED | WS_THICKFRAME | WS_CLIPCHILDREN | WS_MAXIMIZEBOX |
- // WS_MINIMIZEBOX | WS_SYSMENU | WS_SIZEBOX,
- // 10, 10, 800, 600, NULL, top, Instance, NULL);
- ThawWindowPos(MainWindow);
- IoListHeight = 100;
- ThawDWORD(IoListHeight);
-
- InitCommonControls();
- InitForDrawing();
-
- MakeMainWindowControls();
- MainWindowResized();
- NewProgram();
- strcpy(CurrentSaveFile, "");
-
- // We are running interactively, or we would already have exited. We
- // can therefore show the window now, and otherwise set up the GUI.
-
- ShowWindow(MainWindow, SW_SHOW);
- SetTimer(MainWindow, TIMER_BLINK_CURSOR, 800, BlinkCursor);
+//-----------------------------------------------------------------------------
+// Entry point into the program.
+//-----------------------------------------------------------------------------
+// int main(int argc, char** argv)
+// {
+// // Check if we're running in non-interactive mode; in that case we should
+// // load the file, compile, and exit.
+// if(argc >= 2) {
+// RunningInBatchMode = TRUE;
+
+// char *err =
+// "Bad command line arguments: run 'ldmicro /c src.ld dest.hex'";
+
+// char *source = lpCmdLine + 2;
+// while(isspace(*source)) {
+// source++;
+// }
+// if(*source == '\0') { Error(err); exit(-1); }
+// char *dest = source;
+// while(!isspace(*dest) && *dest) {
+// dest++;
+// }
+// if(*dest == '\0') { Error(err); exit(-1); }
+// *dest = '\0'; dest++;
+// while(isspace(*dest)) {
+// dest++;
+// }
+// if(*dest == '\0') { Error(err); exit(-1); }
+// if(!LoadProjectFromFile(source)) {
+// Error("Couldn't open '%s', running non-interactively.", source);
+// exit(-1);
+// }
+// strcpy(CurrentCompileFile, dest);
+// GenerateIoList(-1);
+// CompileProgram(FALSE); /// Requires an open dialog to get file name
+// exit(0);
+// }
+
+// Instance = hInstance;
+
+// MainHeap = HeapCreate(0, 1024*64, 0);
+
+// // MakeWindowClass();
+// // MakeDialogBoxClass();
+// // MakeAdvancedDialogClass();
+// // MakeAdvancedWorkspaceClass();
+// // MakeComponentListClass();
+// // MakeSmplDialogClass();
+// // MakeNamingListClass();
+// HMENU top = MakeMainWindowMenus();
+
+// /// Make main window
+// // MainWindow = CreateWindowEx(0, "LDmicro", "",
+// // WS_OVERLAPPED | WS_THICKFRAME | WS_CLIPCHILDREN | WS_MAXIMIZEBOX |
+// // WS_MINIMIZEBOX | WS_SYSMENU | WS_SIZEBOX,
+// // 10, 10, 800, 600, NULL, top, Instance, NULL);
+// ThawWindowPos(MainWindow);
+// IoListHeight = 100;
+// ThawDWORD(IoListHeight);
+
+// InitCommonControls();
+// InitForDrawing();
+
+// MakeMainWindowControls();
+// MainWindowResized();
+// NewProgram();
+// strcpy(CurrentSaveFile, "");
+
+// // We are running interactively, or we would already have exited. We
+// // can therefore show the window now, and otherwise set up the GUI.
+
+// ShowWindow(MainWindow, SW_SHOW);
+// SetTimer(MainWindow, TIMER_BLINK_CURSOR, 800, BlinkCursor);
- if(strlen(lpCmdLine) > 0) {
- char line[MAX_PATH];
- if(*lpCmdLine == '"') {
- strcpy(line, lpCmdLine+1);
- } else {
- strcpy(line, lpCmdLine);
- }
- if(strchr(line, '"')) *strchr(line, '"') = '\0';
-
- char *s;
- GetFullPathName(line, sizeof(CurrentSaveFile), CurrentSaveFile, &s);
- if(!LoadProjectFromFile(CurrentSaveFile)) {
- NewProgram();
- Error(_("Couldn't open '%s'."), CurrentSaveFile);
- CurrentSaveFile[0] = '\0';
- }
- UndoFlush();
- }
-
- GenerateIoListDontLoseSelection();
- RefreshScrollbars();
- UpdateMainWindowTitleBar();
-
- MSG msg;
- DWORD ret;
- while(ret = GetMessage(&msg, NULL, 0, 0)) {
- if(msg.hwnd == IoList && msg.message == WM_KEYDOWN) {
- if(msg.wParam == VK_TAB) {
- SetFocus(MainWindow);
- continue;
- }
- }
- if(msg.message == WM_KEYDOWN && msg.wParam != VK_UP &&
- msg.wParam != VK_DOWN && msg.wParam != VK_RETURN && msg.wParam
- != VK_SHIFT)
- {
- if(msg.hwnd == IoList) {
- msg.hwnd = MainWindow;
- SetFocus(MainWindow);
- }
- }
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- FreezeWindowPos(MainWindow);
- FreezeDWORD(IoListHeight);
-
- return 0;
-}
+// if(strlen(lpCmdLine) > 0) {
+// char line[MAX_PATH];
+// if(*lpCmdLine == '"') {
+// strcpy(line, lpCmdLine+1);
+// } else {
+// strcpy(line, lpCmdLine);
+// }
+// if(strchr(line, '"')) *strchr(line, '"') = '\0';
+
+// char *s;
+// GetFullPathName(line, sizeof(CurrentSaveFile), CurrentSaveFile, &s);
+// if(!LoadProjectFromFile(CurrentSaveFile)) {
+// NewProgram();
+// Error(_("Couldn't open '%s'."), CurrentSaveFile);
+// CurrentSaveFile[0] = '\0';
+// }
+// UndoFlush();
+// }
+
+// GenerateIoListDontLoseSelection();
+// RefreshScrollbars();
+// UpdateMainWindowTitleBar();
+
+// MSG msg;
+// DWORD ret;
+// while(ret = GetMessage(&msg, NULL, 0, 0)) {
+// if(msg.hwnd == IoList && msg.message == WM_KEYDOWN) {
+// if(msg.wParam == VK_TAB) {
+// SetFocus(MainWindow);
+// continue;
+// }
+// }
+// if(msg.message == WM_KEYDOWN && msg.wParam != VK_UP &&
+// msg.wParam != VK_DOWN && msg.wParam != VK_RETURN && msg.wParam
+// != VK_SHIFT)
+// {
+// if(msg.hwnd == IoList) {
+// msg.hwnd = MainWindow;
+// SetFocus(MainWindow);
+// }
+// }
+// TranslateMessage(&msg);
+// DispatchMessage(&msg);
+// }
+// FreezeWindowPos(MainWindow);
+// FreezeDWORD(IoListHeight);
+
+// return 0;
+// }