From 5c01aef5fd87870b63511f17bd50405a0df08a3b Mon Sep 17 00:00:00 2001 From: Rr42 Date: Tue, 29 May 2018 10:46:19 +0530 Subject: Freeze library updated and renamed to freezeLD (working) --- ldmicro/lib/linuxUI/linuxUI.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 ldmicro/lib/linuxUI/linuxUI.cpp (limited to 'ldmicro/lib/linuxUI/linuxUI.cpp') diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp new file mode 100644 index 0000000..8237d7d --- /dev/null +++ b/ldmicro/lib/linuxUI/linuxUI.cpp @@ -0,0 +1,18 @@ +#include "linuxUI.h" + +/// Wraper function for gtk_window_has_toplevel_focus +BOOL isFocus(HWID window) +{ + return (BOOL) gtk_window_has_toplevel_focus(GTK_WINDOW(gtk_widget_get_parent_window(GTK_WIDGET(window)))); +} + +COLORREF RGB(int red, int green, int blue) +{ + COLORREF col; + col.red = red/255.0; + col.green = green/255.0; + col.blue = blue/255.0; + col.alpha = 1.0; + + return col; +} \ No newline at end of file -- cgit From eb8f6932fe45f550bc2b77c1b3e578884ed60d91 Mon Sep 17 00:00:00 2001 From: Rr42 Date: Wed, 30 May 2018 12:11:46 +0530 Subject: Added message box functionality --- ldmicro/lib/linuxUI/linuxUI.cpp | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'ldmicro/lib/linuxUI/linuxUI.cpp') diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp index 8237d7d..ffaf023 100644 --- a/ldmicro/lib/linuxUI/linuxUI.cpp +++ b/ldmicro/lib/linuxUI/linuxUI.cpp @@ -15,4 +15,43 @@ COLORREF RGB(int red, int green, int blue) col.alpha = 1.0; return col; -} \ No newline at end of file +} + +void 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) + mType = GTK_MESSAGE_ERROR; + else if (mFlags & MB_ICONQUESTION == MB_ICONQUESTION) + mType = GTK_MESSAGE_QUESTION; + else if (mFlags & MB_ICONWARNING == MB_ICONWARNING) + mType = GTK_MESSAGE_WARNING; + else if (mFlags & MB_ICONINFORMATION == MB_ICONINFORMATION) + mType = GTK_MESSAGE_INFO; + else + mType = GTK_MESSAGE_OTHER; + + mType = GTK_MESSAGE_ERROR; + HWID dialog = gtk_message_dialog_new (GTK_WINDOW(pWindow), + flags, + mType, + mButtons, + message); + 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)); + gtk_widget_destroy (dialog); + } \ No newline at end of file -- cgit From 8f1f63ff88e62cb47cad286481033275e8490650 Mon Sep 17 00:00:00 2001 From: Rr42 Date: Wed, 30 May 2018 16:57:42 +0530 Subject: ported GetSaveFileName function from windows.h --- ldmicro/lib/linuxUI/linuxUI.cpp | 51 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) (limited to 'ldmicro/lib/linuxUI/linuxUI.cpp') diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp index ffaf023..74269d9 100644 --- a/ldmicro/lib/linuxUI/linuxUI.cpp +++ b/ldmicro/lib/linuxUI/linuxUI.cpp @@ -54,4 +54,53 @@ void MessageBox(HWID pWindow, char* message, char* title, UINT mFlags) gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(dialog), message); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); - } \ No newline at end of file + } + +BOOL GetSaveFileName(OPENFILENAME ofn) +{ + GtkWidget *dialog; + GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN; + + dialog = gtk_file_chooser_dialog_new ("Open File", + GTK_WINDOW(window), + action, + "_Cancel", + GTK_RESPONSE_CANCEL, + "_Open", + GTK_RESPONSE_ACCEPT, + NULL); + + GtkFileFilter *filter = gtk_file_filter_new (); + gtk_file_filter_add_pattern (filter, "*"); + gtk_file_filter_set_name (filter, "All files"); + gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); + + filter = gtk_file_filter_new (); + gtk_file_filter_add_pattern (filter, "*.c"); + gtk_file_filter_add_pattern (filter, "*.cpp"); + gtk_file_filter_set_name (filter, "C source files"); + gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); + + filter = gtk_file_filter_new (); + gtk_file_filter_add_pattern (filter, "*.h"); + gtk_file_filter_set_name (filter, "C hedder files"); + gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); + + filter = gtk_file_filter_new (); + gtk_file_filter_add_pattern (filter, "*.hex"); + gtk_file_filter_set_name (filter, "hex files"); + gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); + + filter = gtk_file_filter_new (); + gtk_file_filter_add_pattern (filter, "*.int"); + gtk_file_filter_set_name (filter, "int files"); + gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); + gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter); + + BOOL exitStatus = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT; + if (exitStatus) + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); + gtk_widget_destroy (dialog); + + return exitStatus; +} \ No newline at end of file -- cgit From 39d3eeb5fc8c969f8eed03e0c1fc818453cca6df Mon Sep 17 00:00:00 2001 From: NatsuDrag9 Date: Thu, 31 May 2018 11:43:09 +0530 Subject: Ported the function updating titlebar. --- ldmicro/lib/linuxUI/linuxUI.cpp | 94 ++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 44 deletions(-) (limited to 'ldmicro/lib/linuxUI/linuxUI.cpp') diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp index 6dabd80..8904f77 100644 --- a/ldmicro/lib/linuxUI/linuxUI.cpp +++ b/ldmicro/lib/linuxUI/linuxUI.cpp @@ -38,6 +38,12 @@ int ScrollWidth; // Width of scrolli int ScrollHeight; // Height of scrolling HWID IoList; // Window for list view +// ldmicro.cpp +char CurrentSaveFile[MAX_PATH]; + +// Simulation Mode +BOOL InSimulationMode; + /// Wraper function for gtk_window_has_toplevel_focus BOOL isFocus(HWID window) { @@ -94,51 +100,51 @@ void MessageBox(HWID pWindow, char* message, char* title, UINT mFlags) gtk_widget_destroy (dialog); } -BOOL GetSaveFileName(OPENFILENAME ofn) -{ - GtkWidget *dialog; - GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN; - - dialog = gtk_file_chooser_dialog_new ("Open File", - GTK_WINDOW(window), - action, - "_Cancel", - GTK_RESPONSE_CANCEL, - "_Open", - GTK_RESPONSE_ACCEPT, - NULL); - - GtkFileFilter *filter = gtk_file_filter_new (); - gtk_file_filter_add_pattern (filter, "*"); - gtk_file_filter_set_name (filter, "All files"); - gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); - - filter = gtk_file_filter_new (); - gtk_file_filter_add_pattern (filter, "*.c"); - gtk_file_filter_add_pattern (filter, "*.cpp"); - gtk_file_filter_set_name (filter, "C source files"); - gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); - - filter = gtk_file_filter_new (); - gtk_file_filter_add_pattern (filter, "*.h"); - gtk_file_filter_set_name (filter, "C hedder files"); - gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); +// BOOL GetSaveFileName(OPENFILENAME ofn) +// { +// GtkWidget *dialog; +// GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN; + +// dialog = gtk_file_chooser_dialog_new ("Open File", +// GTK_WINDOW(window), +// action, +// "_Cancel", +// GTK_RESPONSE_CANCEL, +// "_Open", +// GTK_RESPONSE_ACCEPT, +// NULL); + +// GtkFileFilter *filter = gtk_file_filter_new (); +// gtk_file_filter_add_pattern (filter, "*"); +// gtk_file_filter_set_name (filter, "All files"); +// gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); + +// filter = gtk_file_filter_new (); +// gtk_file_filter_add_pattern (filter, "*.c"); +// gtk_file_filter_add_pattern (filter, "*.cpp"); +// gtk_file_filter_set_name (filter, "C source files"); +// gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); + +// filter = gtk_file_filter_new (); +// gtk_file_filter_add_pattern (filter, "*.h"); +// gtk_file_filter_set_name (filter, "C hedder files"); +// gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); - filter = gtk_file_filter_new (); - gtk_file_filter_add_pattern (filter, "*.hex"); - gtk_file_filter_set_name (filter, "hex files"); - gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); +// filter = gtk_file_filter_new (); +// gtk_file_filter_add_pattern (filter, "*.hex"); +// gtk_file_filter_set_name (filter, "hex files"); +// gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); - filter = gtk_file_filter_new (); - gtk_file_filter_add_pattern (filter, "*.int"); - gtk_file_filter_set_name (filter, "int files"); - gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); - gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter); +// filter = gtk_file_filter_new (); +// gtk_file_filter_add_pattern (filter, "*.int"); +// gtk_file_filter_set_name (filter, "int files"); +// gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); +// gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter); - BOOL exitStatus = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT; - if (exitStatus) - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); - gtk_widget_destroy (dialog); +// BOOL exitStatus = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT; +// if (exitStatus) +// filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); +// gtk_widget_destroy (dialog); - return exitStatus; -} \ No newline at end of file +// return exitStatus; +// } \ No newline at end of file -- cgit From 82eb7fb321374f9cf1cebfc141e2594a7141a4c0 Mon Sep 17 00:00:00 2001 From: Rr42 Date: Thu, 31 May 2018 12:33:57 +0530 Subject: Added File selection dialogue --- ldmicro/lib/linuxUI/linuxUI.cpp | 81 +++++++++++++++++++++++++++-------------- 1 file changed, 53 insertions(+), 28 deletions(-) (limited to 'ldmicro/lib/linuxUI/linuxUI.cpp') diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp index 6dabd80..747b52e 100644 --- a/ldmicro/lib/linuxUI/linuxUI.cpp +++ b/ldmicro/lib/linuxUI/linuxUI.cpp @@ -94,51 +94,76 @@ void MessageBox(HWID pWindow, char* message, char* title, UINT mFlags) gtk_widget_destroy (dialog); } -BOOL GetSaveFileName(OPENFILENAME ofn) +BOOL GetSaveFileName(OPENFILENAME *ofn) { GtkWidget *dialog; GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN; - dialog = gtk_file_chooser_dialog_new ("Open File", - GTK_WINDOW(window), + dialog = gtk_file_chooser_dialog_new (ofn->lpstrTitle, + GTK_WINDOW(ofn->parentWindow), action, "_Cancel", GTK_RESPONSE_CANCEL, "_Open", GTK_RESPONSE_ACCEPT, NULL); + //g_print("filter created\n"); + + if (ofn->Flags & OFN_OVERWRITEPROMPT == OFN_OVERWRITEPROMPT) + gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE); GtkFileFilter *filter = gtk_file_filter_new (); - gtk_file_filter_add_pattern (filter, "*"); - gtk_file_filter_set_name (filter, "All files"); - gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); - - filter = gtk_file_filter_new (); - gtk_file_filter_add_pattern (filter, "*.c"); - gtk_file_filter_add_pattern (filter, "*.cpp"); - gtk_file_filter_set_name (filter, "C source files"); - gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); - - filter = gtk_file_filter_new (); - gtk_file_filter_add_pattern (filter, "*.h"); - gtk_file_filter_set_name (filter, "C hedder files"); - gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); + char* strFilter = new char[strlen(ofn->lpstrFilter)]; + DWORD strFilterLen = 0; + BOOL filterResetFlag = FALSE; - filter = gtk_file_filter_new (); - gtk_file_filter_add_pattern (filter, "*.hex"); - gtk_file_filter_set_name (filter, "hex files"); - gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); + for (int i = 0; !(ofn->lpstrFilter[i] == '\0' && ofn->lpstrFilter[i-1] == '\0'); ++i) + { + memcpy (strFilter + strFilterLen, &ofn->lpstrFilter[i], 1 ); + ++strFilterLen; + if (ofn->lpstrFilter[i] == '\0') + if (filterResetFlag) + { + gtk_file_filter_add_pattern (GTK_FILE_FILTER(filter), strFilter); + gtk_file_chooser_add_filter (GTK_FILE_CHOOSER(dialog), filter); + filter = gtk_file_filter_new (); + strFilterLen = 0; + //g_print("filter pat: %s\n", strFilter); + //g_print("filter reset\n"); + filterResetFlag = FALSE; + } + else + { + gtk_file_filter_set_name (GTK_FILE_FILTER(filter), strFilter); + //g_print("filter name: %s\n", strFilter); + strFilterLen = 0; + filterResetFlag = TRUE; + } + } + //g_print("filter rules added\n"); - filter = gtk_file_filter_new (); - gtk_file_filter_add_pattern (filter, "*.int"); - gtk_file_filter_set_name (filter, "int files"); - gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter); - gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter); + sprintf(strFilter, "*.%s", ofn->lpstrDefExt); + gtk_file_filter_add_pattern (GTK_FILE_FILTER(filter), strFilter); + //gtk_file_filter_set_name (filter, "int files"); + gtk_file_chooser_set_filter (GTK_FILE_CHOOSER(dialog), filter); - BOOL exitStatus = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT; + delete strFilter; + + //g_print("default filter set\n"); + + BOOL exitStatus = gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT; if (exitStatus) - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); + { + char* str; + str = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(dialog)); + strcpy(ofn->lpstrFile, str); + g_free(str); + } + //g_print("file path saved: %s\n", ofn->lpstrFile); + gtk_widget_destroy (dialog); + //g_print("exit\n"); + return exitStatus; } \ No newline at end of file -- cgit From 0e41f9a700e928970f79b20d8d6a0f9993b16df6 Mon Sep 17 00:00:00 2001 From: NatsuDrag9 Date: Thu, 31 May 2018 12:35:36 +0530 Subject: Rearranged variables --- ldmicro/lib/linuxUI/linuxUI.cpp | 45 ++--------------------------------------- 1 file changed, 2 insertions(+), 43 deletions(-) (limited to 'ldmicro/lib/linuxUI/linuxUI.cpp') diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp index 8904f77..3dbe1bb 100644 --- a/ldmicro/lib/linuxUI/linuxUI.cpp +++ b/ldmicro/lib/linuxUI/linuxUI.cpp @@ -1,49 +1,8 @@ #include "linuxUI.h" /// Menu Variables -HWID window; -HWID menu_box; // Box for alignment -HWID packed_menu_box; // Stores the packed box -HWID FileMenu; // File Menu -HWID EditMenu; // Edit Menu -HWID settings; // Settings Menu -HWID ProcessorMenu; // Processor Menu -HWID InstructionMenu; // Instruction Menu -HWID compile; // Compile Menu -HWID help; // Help Menu -HWID SimulateMenu; // Simulate Menu -HWID menu_bar; // Menu Bar -HWID file_label; // File menu label -HWID edit_label; // Edit menu label -HWID instruction_label; // Instruction menu label -HWID settings_label; // Settings menu label -HWID compile_label; // Compile menu label -HWID help_label; // Help menu label -HWID simulate_label; // Simulate menu label -HWID file_menu_items; // File menu item -HWID edit_menu_items; // Edit menu item -HWID instruction_menu_items; // Instruction menu item -HWID settings_menu_items; // Settings menu item -HWID processor_menu_items; // Processor menu items -HWID compile_menu_items; // Compile menu item -HWID help_menu_items; // Help menu item -HWID simulate_menu_items; // Simulate menu item -HWID file_menu_separator; // File menu separator -HWID edit_menu_separator; // Edit menu separator -HWID instruction_menu_separator; // Instruction menu separator -HWID simulate_menu_separator; // Simulate menu separator - -//Scrollbars for the ladder logic area -int ScrollWidth; // Width of scrolling -int ScrollHeight; // Height of scrolling -HWID IoList; // Window for list view - -// ldmicro.cpp -char CurrentSaveFile[MAX_PATH]; - -// Simulation Mode -BOOL InSimulationMode; - + HWID window; + /// Wraper function for gtk_window_has_toplevel_focus BOOL isFocus(HWID window) { -- cgit From 3168849d576631d4316065c18c741ce18f59e48b Mon Sep 17 00:00:00 2001 From: Rr42 Date: Thu, 31 May 2018 14:04:33 +0530 Subject: Fixed bugs in MessageBox --- ldmicro/lib/linuxUI/linuxUI.cpp | 46 ++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 17 deletions(-) (limited to 'ldmicro/lib/linuxUI/linuxUI.cpp') diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp index 747b52e..353b31f 100644 --- a/ldmicro/lib/linuxUI/linuxUI.cpp +++ b/ldmicro/lib/linuxUI/linuxUI.cpp @@ -55,28 +55,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; @@ -85,13 +75,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) -- cgit From 1f483baf37359032ca3224a5d07853aaf725def4 Mon Sep 17 00:00:00 2001 From: Rr42 Date: Mon, 4 Jun 2018 15:25:44 +0530 Subject: Commented all GUI code for core test --- ldmicro/lib/linuxUI/linuxUI.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ldmicro/lib/linuxUI/linuxUI.cpp') diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp index 353b31f..54b42e2 100644 --- a/ldmicro/lib/linuxUI/linuxUI.cpp +++ b/ldmicro/lib/linuxUI/linuxUI.cpp @@ -34,8 +34,8 @@ HWID instruction_menu_separator; // Instruction menu HWID simulate_menu_separator; // Simulate menu separator //Scrollbars for the ladder logic area -int ScrollWidth; // Width of scrolling -int ScrollHeight; // Height of scrolling +// int ScrollWidth; // Width of scrolling +// int ScrollHeight; // Height of scrolling HWID IoList; // Window for list view /// Wraper function for gtk_window_has_toplevel_focus -- cgit From 67b618853b13595749ef89c620de4bc8e967cd02 Mon Sep 17 00:00:00 2001 From: NatsuDrag9 Date: Wed, 6 Jun 2018 10:03:16 +0530 Subject: Ported functions --- ldmicro/lib/linuxUI/linuxUI.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'ldmicro/lib/linuxUI/linuxUI.cpp') diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp index 9d912ea..fea10b5 100644 --- a/ldmicro/lib/linuxUI/linuxUI.cpp +++ b/ldmicro/lib/linuxUI/linuxUI.cpp @@ -2,6 +2,16 @@ /// Menu Variables HWID window; + +/// EnableMenuItem Variables +const UINT MF_ENABLED = 0; +const UINT MF_GRAYED = 1; +const UINT MF_CHECKED = 2; +const UINT MF_UNCHECKED = 3; + +/// ListStore +GtkWidget* view; +GtkTreeViewColumn* column; /// Wraper function for gtk_window_has_toplevel_focus BOOL isFocus(HWID window) @@ -132,3 +142,25 @@ BOOL GetSaveFileName(OPENFILENAME *ofn) return exitStatus; } + +void EnableMenuItem(HMENU MenuName, HMENU MenuItem, UINT CheckEnabledItem) { + switch (CheckEnabledItem){ + case MF_ENABLED : + gtk_widget_set_sensitive (MenuItem, true); + break; + case MF_GRAYED : + gtk_widget_set_sensitive (MenuItem, false); + break; + } +} + +void CheckMenuItem(HMENU MenuName, HMENU MenuItem, UINT Check){ + switch (Check){ + case MF_CHECKED : + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(MenuItem), true); + break; + case MF_UNCHECKED : + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(MenuItem), false); + break; + } +} \ No newline at end of file -- cgit