diff options
author | Akshay Chipkar | 2018-07-23 16:34:58 +0530 |
---|---|---|
committer | GitHub | 2018-07-23 16:34:58 +0530 |
commit | 1d62b0b7053e4f5a8cb6fb9e3b33cf3335b103c8 (patch) | |
tree | a03bc8aa7aae44f3c8305b59a320613d579b8bdb /ldmicro | |
parent | 64b9b4a7cf9d7aa0c947c8771eb43d7a60f1f2f1 (diff) | |
parent | 61ffc674a34b8c3ff9c986dedfe90072b5a16369 (diff) | |
download | LDMicroGtk-1d62b0b7053e4f5a8cb6fb9e3b33cf3335b103c8.tar.gz LDMicroGtk-1d62b0b7053e4f5a8cb6fb9e3b33cf3335b103c8.tar.bz2 LDMicroGtk-1d62b0b7053e4f5a8cb6fb9e3b33cf3335b103c8.zip |
Merge pull request #41 from FOSSEE/GUI_port
Big fixes
Diffstat (limited to 'ldmicro')
-rw-r--r-- | ldmicro/coildialog.cpp | 3 | ||||
-rw-r--r-- | ldmicro/commentdialog.cpp | 3 | ||||
-rw-r--r-- | ldmicro/confdialog.cpp | 3 | ||||
-rw-r--r-- | ldmicro/contactsdialog.cpp | 3 | ||||
-rw-r--r-- | ldmicro/iolist.cpp | 5 | ||||
-rw-r--r-- | ldmicro/ldmicro.cpp | 15 | ||||
-rw-r--r-- | ldmicro/lutdialog.cpp | 12 | ||||
-rw-r--r-- | ldmicro/resetdialog.cpp | 3 | ||||
-rw-r--r-- | ldmicro/simpledialog.cpp | 2 | ||||
-rw-r--r-- | ldmicro/simulate.cpp | 1 |
10 files changed, 44 insertions, 6 deletions
diff --git a/ldmicro/coildialog.cpp b/ldmicro/coildialog.cpp index 1d36f98..48630d4 100644 --- a/ldmicro/coildialog.cpp +++ b/ldmicro/coildialog.cpp @@ -144,6 +144,7 @@ void CoilDialogGetData (char* name){ gtk_widget_set_sensitive (MainWindow, TRUE); DestroyWindow (CoilDialog); + ProgramChanged(); } // Mouse click callback @@ -158,6 +159,7 @@ gboolean CoilDialogKeyPress (HWID widget, GdkEventKey* event, gpointer data){ } else if (event -> keyval == GDK_KEY_Escape){ DestroyWindow (CoilDialog); + ProgramChanged(); gtk_widget_set_sensitive (MainWindow, TRUE); } return FALSE; @@ -166,6 +168,7 @@ gboolean CoilDialogKeyPress (HWID widget, GdkEventKey* event, gpointer data){ // Calls DestroyWindow void CoilCallDestroyWindow (HWID widget, gpointer data){ DestroyWindow (CoilDialog); + ProgramChanged(); gtk_widget_set_sensitive (MainWindow, TRUE); } diff --git a/ldmicro/commentdialog.cpp b/ldmicro/commentdialog.cpp index e6743b4..4ceb107 100644 --- a/ldmicro/commentdialog.cpp +++ b/ldmicro/commentdialog.cpp @@ -59,6 +59,7 @@ void CommentDialogGetData (char* comment){ MAX_COMMENT_LEN-1); gtk_widget_set_sensitive (MainWindow, TRUE); DestroyWindow (CommentDialog); + ProgramChanged(); } // Mouse click callback @@ -74,12 +75,14 @@ gboolean CommentDialogKeyPress (HWID widget, GdkEventKey* event, gpointer data){ else if (event -> keyval == GDK_KEY_Escape){ DestroyWindow (CommentDialog); gtk_widget_set_sensitive (MainWindow, TRUE); + ProgramChanged(); } return FALSE; } void CommentCallDestroyWindow (HWID widget, gpointer data){ DestroyWindow (CommentDialog); + ProgramChanged(); gtk_widget_set_sensitive (MainWindow, TRUE); } diff --git a/ldmicro/confdialog.cpp b/ldmicro/confdialog.cpp index 1830de9..099d35a 100644 --- a/ldmicro/confdialog.cpp +++ b/ldmicro/confdialog.cpp @@ -170,6 +170,7 @@ void ConfDialogGetData (GtkWidget* widget, gpointer data){ buf = const_cast <char*> (gtk_entry_get_text (GTK_ENTRY(BaudTextbox))); Prog.baudRate = atoi(buf); DestroyWindow (ConfDialog); + ProgramChanged(); } // Checks for the required key press @@ -179,6 +180,7 @@ gboolean ConfDialogKeyPress (GtkWidget* widget, GdkEventKey* event, gpointer dat } else if (event -> keyval == GDK_KEY_Escape){ DestroyWindow (ConfDialog); + ProgramChanged(); gtk_widget_set_sensitive (MainWindow, TRUE); } return FALSE; @@ -186,6 +188,7 @@ gboolean ConfDialogKeyPress (GtkWidget* widget, GdkEventKey* event, gpointer dat void ConfCallDestroyWindow (HWID widget, gpointer data){ DestroyWindow (ConfDialog); + ProgramChanged(); gtk_widget_set_sensitive (MainWindow, TRUE); } diff --git a/ldmicro/contactsdialog.cpp b/ldmicro/contactsdialog.cpp index bf896fa..38750c8 100644 --- a/ldmicro/contactsdialog.cpp +++ b/ldmicro/contactsdialog.cpp @@ -128,6 +128,7 @@ void ContactsDialogGetData (BOOL* negated, char* name){ strcpy (name+1, gtk_entry_get_text (GTK_ENTRY (NameTextbox))); DestroyWindow (ContactsDialog); + ProgramChanged(); gtk_widget_set_sensitive (MainWindow, TRUE); } @@ -143,6 +144,7 @@ gboolean ContactsDialogKeyPress (HWID widget, GdkEventKey* event, gpointer data) } else if (event -> keyval == GDK_KEY_Escape){ DestroyWindow (ContactsDialog); + ProgramChanged(); gtk_widget_set_sensitive (MainWindow, TRUE); } return FALSE; @@ -150,6 +152,7 @@ gboolean ContactsDialogKeyPress (HWID widget, GdkEventKey* event, gpointer data) void ContactsCallDestroyWindow (HWID widget, gpointer data){ DestroyWindow (ContactsDialog); + ProgramChanged(); gtk_widget_set_sensitive (MainWindow, TRUE); } diff --git a/ldmicro/iolist.cpp b/ldmicro/iolist.cpp index 7b5748f..65a14fc 100644 --- a/ldmicro/iolist.cpp +++ b/ldmicro/iolist.cpp @@ -401,15 +401,18 @@ static gboolean AnalogSliderDialogKeyboardProc(GtkWidget* widget, GdkEventKey* e if (AnalogSliderDone == TRUE || AnalogSliderCancel == TRUE) { DestroyWindow (AnalogSliderMain); + ProgramChanged(); return FALSE; } if (event->keyval == GDK_KEY_Return){ DestroyWindow (AnalogSliderMain); + ProgramChanged(); AnalogSliderDone = TRUE; } else if (event->keyval == GDK_KEY_Escape){ DestroyWindow (AnalogSliderMain); + ProgramChanged(); AnalogSliderDone = TRUE; AnalogSliderCancel = TRUE; } @@ -423,6 +426,7 @@ static gboolean AnalogSliderDialogMouseProc(GtkWidget *widget, GdkEventButton *e SetAdcShadow((char*)name, v); if (event->button == 1 && event->type == GDK_BUTTON_RELEASE){ DestroyWindow (AnalogSliderMain); + ProgramChanged(); AnalogSliderDone = TRUE; } @@ -558,6 +562,7 @@ static void IoDialogProc(BOOL DialogDone, int item) } DestroyWindow(IoDialog); + ProgramChanged(); } void IoDialogRowActivateProc(GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data) diff --git a/ldmicro/ldmicro.cpp b/ldmicro/ldmicro.cpp index 700e490..bdbb332 100644 --- a/ldmicro/ldmicro.cpp +++ b/ldmicro/ldmicro.cpp @@ -66,7 +66,7 @@ char CurrentCompileFile[MAX_PATH]; PlcProgram Prog; /// Function to safely quit program gtk main loop -void LD_WM_Close_call(GtkWidget *widget, GdkEvent *event, gpointer user_data); +gboolean LD_WM_Close_call(GtkWidget *widget, GdkEvent *event, gpointer user_data); //----------------------------------------------------------------------------- // Get a filename with a common dialog box and then save the program to that @@ -699,18 +699,20 @@ gboolean LD_WM_KeyDown_call(GtkWidget *widget, GdkEventKey *event, gpointer user return FALSE; } -void LD_WM_Close_call(GtkWidget *widget, GdkEvent *event, gpointer user_data) +gboolean LD_WM_Close_call(GtkWidget *widget, GdkEvent *event, gpointer user_data) { /* Handles: * WM_CLOSE */ - CheckSaveUserCancels(); + if(CheckSaveUserCancels()) + return TRUE; FreezeWindowPos(MainWindow); FreezeDWORD(IoListHeight); gtk_main_quit(); + gdk_threads_leave(); } gboolean LD_GTK_mouse_click_hook(GtkWidget *widget, GdkEvent *event, gpointer user_data) @@ -876,18 +878,20 @@ gboolean LD_WM_Paint_call(HWID widget, HCRDC cr, gpointer data) return FALSE; } -void LD_WM_Destroy_call(GtkWidget *widget, GdkEvent *event, gpointer user_data) +gboolean LD_WM_Destroy_call(GtkWidget *widget, GdkEvent *event, gpointer user_data) { /* Handles: * WM_DESTROY */ - CheckSaveUserCancels(); + if(CheckSaveUserCancels()) + return TRUE; FreezeWindowPos(MainWindow); FreezeDWORD(IoListHeight); gtk_main_quit(); + gdk_threads_leave(); } gboolean LD_WM_Size_call(GtkWidget *widget, GdkEvent *event, gpointer user_data) @@ -1342,6 +1346,5 @@ int main(int argc, char** argv) // } gtk_main(); - gdk_threads_leave(); return EXIT_SUCCESS; }
\ No newline at end of file diff --git a/ldmicro/lutdialog.cpp b/ldmicro/lutdialog.cpp index e106e31..04e7684 100644 --- a/ldmicro/lutdialog.cpp +++ b/ldmicro/lutdialog.cpp @@ -195,6 +195,7 @@ static void DestroyLutControls(BOOL destroyFlag = TRUE) DestroyWindow(ValuesLabel[i]); } } + ProgramChanged(); } } @@ -222,6 +223,7 @@ static void DestroyLutControlsPiecewise(BOOL destroyFlag = TRUE) DestroyWindow(ValuesTextbox[i]); DestroyWindow(ValuesLabel[i]); } + ProgramChanged(); } } @@ -434,12 +436,14 @@ void LookUpTableCheckMode (void){ DestroyWindow(ValuesLabel[i]); } } + ProgramChanged(); } else { DestroyLutControls(); if (!x && GTK_IS_ENTRY(StringTextbox)) { DestroyWindow(StringTextbox); + ProgramChanged(); gtk_editable_set_editable (GTK_EDITABLE (CountTextbox), TRUE); } } @@ -456,12 +460,14 @@ gboolean LookUpTableKeyPress (HWID widget, GdkEventKey* event, gpointer data){ LookUpTableCheckMode (); LookUpTableGetData((gpointer) data); DestroyWindow (LutDialog); + ProgramChanged(); gtk_widget_set_sensitive (MainWindow, TRUE); g_source_remove (LUT_DIALOG_REFRESH_TIMER_ID_1); LUT_DIALOG_REFRESH_TIMER_ID_1 = 0; } else if (event -> keyval == GDK_KEY_Escape){ DestroyWindow (LutDialog); + ProgramChanged(); gtk_widget_set_sensitive (MainWindow, TRUE); g_source_remove (LUT_DIALOG_REFRESH_TIMER_ID_1); LUT_DIALOG_REFRESH_TIMER_ID_1 = 0; @@ -483,6 +489,7 @@ void LutDialogOk (HWID widget, gpointer data) LookUpTableGetData((gpointer) data); DestroyWindow (LutDialog); + ProgramChanged(); gtk_widget_set_sensitive (MainWindow, TRUE); g_source_remove (LUT_DIALOG_REFRESH_TIMER_ID_1); LUT_DIALOG_REFRESH_TIMER_ID_1 = 0; @@ -492,6 +499,7 @@ void LutDialogOk (HWID widget, gpointer data) void LutCallCancel (HWID widget, gpointer data) { DestroyWindow (LutDialog); + ProgramChanged(); gtk_widget_set_sensitive (MainWindow, TRUE); g_source_remove (LUT_DIALOG_REFRESH_TIMER_ID_1); LUT_DIALOG_REFRESH_TIMER_ID_1 = 0; @@ -621,6 +629,7 @@ void PiecewiseDialogOk (HWID widget, gpointer data) PiecewiseDialogGetData((gpointer) data); DestroyWindow (LutDialog); + ProgramChanged(); gtk_widget_set_sensitive (MainWindow, TRUE); g_source_remove (LUT_DIALOG_REFRESH_TIMER_ID_2); LUT_DIALOG_REFRESH_TIMER_ID_2 = 0; @@ -633,12 +642,14 @@ gboolean PiecewiseDialogKeyPress (HWID widget, GdkEventKey* event, gpointer data PiecewiseDialogPointTextbox (piecewiseTmpCount); PiecewiseDialogGetData((gpointer) data); DestroyWindow (LutDialog); + ProgramChanged(); gtk_widget_set_sensitive (MainWindow, TRUE); g_source_remove (LUT_DIALOG_REFRESH_TIMER_ID_2); LUT_DIALOG_REFRESH_TIMER_ID_2 = 0; } else if (event -> keyval == GDK_KEY_Escape){ DestroyWindow (LutDialog); + ProgramChanged(); gtk_widget_set_sensitive (MainWindow, TRUE); g_source_remove (LUT_DIALOG_REFRESH_TIMER_ID_2); LUT_DIALOG_REFRESH_TIMER_ID_2 = 0; @@ -650,6 +661,7 @@ gboolean PiecewiseDialogKeyPress (HWID widget, GdkEventKey* event, gpointer data void PiecewiseCallCancel (HWID widget, gpointer data) { DestroyWindow (LutDialog); + ProgramChanged(); gtk_widget_set_sensitive (MainWindow, TRUE); g_source_remove (LUT_DIALOG_REFRESH_TIMER_ID_2); LUT_DIALOG_REFRESH_TIMER_ID_2 = 0; diff --git a/ldmicro/resetdialog.cpp b/ldmicro/resetdialog.cpp index 238814a..ff250df 100644 --- a/ldmicro/resetdialog.cpp +++ b/ldmicro/resetdialog.cpp @@ -96,6 +96,7 @@ void ResetDialogGetData (char* name){ strcpy (name+1, gtk_entry_get_text (GTK_ENTRY (NameTextbox))); gtk_widget_set_sensitive (MainWindow, TRUE); DestroyWindow (ResetDialog); + ProgramChanged(); } // Mouse click callback @@ -110,6 +111,7 @@ gboolean ResetDialogKeyPress (HWID widget, GdkEventKey* event, gpointer data){ } else if (event -> keyval == GDK_KEY_Escape){ DestroyWindow (ResetDialog); + ProgramChanged(); gtk_widget_set_sensitive (MainWindow, TRUE); } return FALSE; @@ -117,6 +119,7 @@ gboolean ResetDialogKeyPress (HWID widget, GdkEventKey* event, gpointer data){ void ResetCallDestroyWindow (HWID widget, gpointer data){ DestroyWindow (ResetDialog); + ProgramChanged(); gtk_widget_set_sensitive (MainWindow, TRUE); } diff --git a/ldmicro/simpledialog.cpp b/ldmicro/simpledialog.cpp index 0d63a22..b41bae1 100644 --- a/ldmicro/simpledialog.cpp +++ b/ldmicro/simpledialog.cpp @@ -303,12 +303,14 @@ void SimpleDialogWrapUp() } DestroyWindow(SimpleDialog); + ProgramChanged(); SIMPLE_DIALOG_ACTIVE = FALSE; } void SimpleDialogCancelProc() { DestroyWindow(SimpleDialog); + ProgramChanged(); SIMPLE_DIALOG_ACTIVE = FALSE; } diff --git a/ldmicro/simulate.cpp b/ldmicro/simulate.cpp index 8cee5fe..59e7b6e 100644 --- a/ldmicro/simulate.cpp +++ b/ldmicro/simulate.cpp @@ -957,6 +957,7 @@ void DestroyUartSimulationWindow(void) FreezeDWORD(TerminalH); DestroyWindow(UartSimulationWindow); + ProgramChanged(); UartSimulationWindow = NULL; } |