summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatsuDrag92018-06-06 16:37:58 +0530
committerNatsuDrag92018-06-06 16:37:58 +0530
commit2128bafaf7d03cd412d8848204352d406aadb1fc (patch)
treef8d0c34082938e4ef61ab97e972071b9d9bf6713
parent51184db35fe7c9b1f81b50473cb46f4b017088f9 (diff)
parent42f0b6abf37b6afc278a218b8301b7d4f1f6b2cc (diff)
downloadLDMicroGtk-2128bafaf7d03cd412d8848204352d406aadb1fc.tar.gz
LDMicroGtk-2128bafaf7d03cd412d8848204352d406aadb1fc.tar.bz2
LDMicroGtk-2128bafaf7d03cd412d8848204352d406aadb1fc.zip
Updated ListStore
-rw-r--r--ldmicro/ldmicro.cpp64
-rw-r--r--ldmicro/lib/linuxUI/linuxUI.cpp46
-rw-r--r--ldmicro/lib/linuxUI/linuxUI.h22
3 files changed, 107 insertions, 25 deletions
diff --git a/ldmicro/ldmicro.cpp b/ldmicro/ldmicro.cpp
index 19f825c..d11a7b2 100644
--- a/ldmicro/ldmicro.cpp
+++ b/ldmicro/ldmicro.cpp
@@ -1059,6 +1059,7 @@ int main (int argc, char *argv[])
g_object_unref (app);
+<<<<<<< HEAD
return status;
}
@@ -1135,6 +1136,69 @@ int main (int argc, char *argv[])
// ShowWindow(MainWindow, SW_SHOW);
// SetTimer(MainWindow, TIMER_BLINK_CURSOR, 800, BlinkCursor);
+=======
+ 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);
+ 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);
+>>>>>>> 42f0b6abf37b6afc278a218b8301b7d4f1f6b2cc
// if(strlen(lpCmdLine) > 0) {
// char line[MAX_PATH];
diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp
index 1cf45f4..3bebf6d 100644
--- a/ldmicro/lib/linuxUI/linuxUI.cpp
+++ b/ldmicro/lib/linuxUI/linuxUI.cpp
@@ -27,28 +27,18 @@ COLORREF RGB(int red, int green, int blue)
return col;
}
-void MessageBox(HWID pWindow, char* message, char* title, UINT mFlags)
+int MessageBox(HWID pWindow, char* message, char* title, UINT mFlags)
{
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
GtkMessageType mType;
- GtkButtonsType mButtons;
-
- if (mFlags & MB_OK == MB_OK)
- mButtons = GTK_BUTTONS_OK;
- else if (mFlags & MB_OKCANCEL == MB_OKCANCEL)
- mButtons = GTK_BUTTONS_OK_CANCEL;
- else if (mFlags & MB_YESNO == MB_YESNO)
- mButtons = GTK_BUTTONS_YES_NO;
- else
- mButtons = GTK_BUTTONS_CLOSE;
- if (mFlags & MB_ICONERROR == MB_ICONERROR)
+ if ((mFlags & MB_ICONERROR) == MB_ICONERROR)
mType = GTK_MESSAGE_ERROR;
- else if (mFlags & MB_ICONQUESTION == MB_ICONQUESTION)
+ else if ((mFlags & MB_ICONQUESTION) == MB_ICONQUESTION)
mType = GTK_MESSAGE_QUESTION;
- else if (mFlags & MB_ICONWARNING == MB_ICONWARNING)
+ else if ((mFlags & MB_ICONWARNING) == MB_ICONWARNING)
mType = GTK_MESSAGE_WARNING;
- else if (mFlags & MB_ICONINFORMATION == MB_ICONINFORMATION)
+ else if ((mFlags & MB_ICONINFORMATION) == MB_ICONINFORMATION)
mType = GTK_MESSAGE_INFO;
else
mType = GTK_MESSAGE_OTHER;
@@ -57,13 +47,35 @@ void MessageBox(HWID pWindow, char* message, char* title, UINT mFlags)
HWID dialog = gtk_message_dialog_new (GTK_WINDOW(pWindow),
flags,
mType,
- mButtons,
+ GTK_BUTTONS_NONE,
message);
+
+ if ((mFlags & MB_OKCANCEL) == MB_OKCANCEL)
+ {
+ gtk_dialog_add_button(GTK_DIALOG(dialog), "_OK", IDOK);
+ gtk_dialog_add_button(GTK_DIALOG(dialog), "_CANCEL", IDCANCEL);
+ }
+ else if ((mFlags & MB_YESNO) == MB_YESNO)
+ {
+ gtk_dialog_add_button(GTK_DIALOG(dialog), "_YES", IDYES);
+ gtk_dialog_add_button(GTK_DIALOG(dialog), "_NO", IDNO);
+ }
+ else if ((mFlags & MB_YESNOCANCEL) == MB_YESNOCANCEL)
+ {
+ gtk_dialog_add_button(GTK_DIALOG(dialog), "_YES", IDYES);
+ gtk_dialog_add_button(GTK_DIALOG(dialog), "_NO", IDNO);
+ gtk_dialog_add_button(GTK_DIALOG(dialog), "_CANCEL", IDCANCEL);
+ }
+ else
+ gtk_dialog_add_button(GTK_DIALOG(dialog), "OK", IDOK);
+
gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG(dialog),
title);
gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(dialog), message);
- gtk_dialog_run (GTK_DIALOG (dialog));
+ int result = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
+
+ return result;
}
BOOL GetSaveFileName(OPENFILENAME *ofn)
diff --git a/ldmicro/lib/linuxUI/linuxUI.h b/ldmicro/lib/linuxUI/linuxUI.h
index a7c8ce5..8efb6ef 100644
--- a/ldmicro/lib/linuxUI/linuxUI.h
+++ b/ldmicro/lib/linuxUI/linuxUI.h
@@ -14,19 +14,25 @@
/// Flags
/// message box
-#define MB_OK 0x00000000L
-#define MB_OKCANCEL 0x00000001L
+#define MB_OK 0x00000001L
+#define MB_OKCANCEL 0x00000002L
#define MB_YESNO 0x00000004L
+#define MB_YESNOCANCEL 0x00000008L
+
+#define IDOK 1
+#define IDCANCEL 2
+#define IDYES 3
+#define IDNO 4
#define MB_ICONERROR 0x00000010L
#define MB_ICONQUESTION 0x00000020L
-#define MB_ICONWARNING 0x00000030L
-#define MB_ICONINFORMATION 0x00000040L
+#define MB_ICONWARNING 0x00000040L
+#define MB_ICONINFORMATION 0x00000080L
/// open/save file
-#define OFN_PATHMUSTEXIST 0x00000800
-#define OFN_HIDEREADONLY 0x00000004
-#define OFN_OVERWRITEPROMPT 0x00000002
+#define OFN_PATHMUSTEXIST 0x00000100L
+#define OFN_HIDEREADONLY 0x00000200L
+#define OFN_OVERWRITEPROMPT 0x00000400L
/// EnableMenuItem variables
extern const UINT MF_ENABLED;
@@ -53,7 +59,7 @@ typedef struct OpenFileInfoData {
/// functions
BOOL isFocus(HWID);
COLORREF RGB(int, int, int);
-void MessageBox(HWID, char*, char*, UINT);
+int MessageBox(HWID, char*, char*, UINT);
BOOL GetSaveFileName(OPENFILENAME* );
void EnableMenuItem(HMENU, HMENU, UINT);
void CheckMenuItem(HMENU, HMENU, UINT);