summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakshay-c2019-01-18 16:25:30 +0530
committerakshay-c2019-01-18 16:25:30 +0530
commitc41c6cc508d94d97eed40ad8efd4b8dfd4a105f6 (patch)
treea098e5fe96b68a705b1602413f56a3e05f732acd
parent252f21ab1f1639a1e936fe0e7b77975b40a0df7a (diff)
downloadLDMicroGtk-c41c6cc508d94d97eed40ad8efd4b8dfd4a105f6.tar.gz
LDMicroGtk-c41c6cc508d94d97eed40ad8efd4b8dfd4a105f6.tar.bz2
LDMicroGtk-c41c6cc508d94d97eed40ad8efd4b8dfd4a105f6.zip
Refined close for timers, close defined for other dialogs
-rw-r--r--ldmicro/coildialog.cpp18
-rw-r--r--ldmicro/commentdialog.cpp16
-rw-r--r--ldmicro/contactsdialog.cpp18
-rw-r--r--ldmicro/lutdialog.cpp20
-rw-r--r--ldmicro/resetdialog.cpp16
-rw-r--r--ldmicro/simpledialog.cpp12
6 files changed, 100 insertions, 0 deletions
diff --git a/ldmicro/coildialog.cpp b/ldmicro/coildialog.cpp
index 48630d4..0cabf3b 100644
--- a/ldmicro/coildialog.cpp
+++ b/ldmicro/coildialog.cpp
@@ -62,6 +62,22 @@ void CoilDialogMyNameProc (GtkEditable *editable, gchar *NewText, gint length,
}
}
+//Set the closing parameters
+
+gboolean CoilDialogClosing(GtkWidget *widget, GdkEvent *event, gpointer user_data)
+{
+ DestroyWindow (CoilDialog);
+ ProgramChanged();
+ gtk_widget_set_sensitive (MainWindow, TRUE);
+}
+
+gboolean CoilDialogDestroyed(GtkWidget *widget, GdkEvent *event, gpointer user_data)
+{
+ DestroyWindow (CoilDialog);
+ ProgramChanged();
+ gtk_widget_set_sensitive (MainWindow, TRUE);
+}
+
static void MakeControls(void)
{
NormalRadio = gtk_radio_button_new_with_label (NULL, "( ) Normal");
@@ -221,6 +237,8 @@ void ShowCoilDialog(BOOL *negated, BOOL *setOnly, BOOL *resetOnly, char *name)
G_CALLBACK(CoilDialogMouseClick), (gpointer)name);
g_signal_connect (G_OBJECT (CancelButton), "clicked",
G_CALLBACK(CoilCallDestroyWindow), NULL);
+ g_signal_connect (CoilDialog, "destroy_event", G_CALLBACK (CoilDialogClosing), NULL);
+ g_signal_connect (CoilDialog, "delete_event", G_CALLBACK (CoilDialogDestroyed), NULL);
return;
}
diff --git a/ldmicro/commentdialog.cpp b/ldmicro/commentdialog.cpp
index 4ceb107..d0a6028 100644
--- a/ldmicro/commentdialog.cpp
+++ b/ldmicro/commentdialog.cpp
@@ -36,6 +36,20 @@ static HWID CommentPackingBox;
static HWID OkButton;
static HWID CancelButton;
+gboolean CommentDialogClosing(GtkWidget *widget, GdkEvent *event, gpointer user_data)
+{
+ DestroyWindow (CommentDialog);
+ ProgramChanged();
+ gtk_widget_set_sensitive (MainWindow, TRUE);
+}
+
+gboolean CommentDialogDestroyed(GtkWidget *widget, GdkEvent *event, gpointer user_data)
+{
+ DestroyWindow (CommentDialog);
+ ProgramChanged();
+ gtk_widget_set_sensitive (MainWindow, TRUE);
+}
+
static void MakeControls(void)
{
CommentTextbox = gtk_entry_new();
@@ -111,6 +125,8 @@ void ShowCommentDialog(char *comment)
G_CALLBACK(CommentDialogMouseClick), (gpointer)comment);
g_signal_connect (G_OBJECT (CancelButton), "clicked",
G_CALLBACK(CommentCallDestroyWindow), NULL);
+ g_signal_connect (CommentDialog, "destroy_event", G_CALLBACK (CommentDialogClosing), NULL);
+ g_signal_connect (CommentDialog, "delete_event", G_CALLBACK (CommentDialogDestroyed), NULL);
return;
}
diff --git a/ldmicro/contactsdialog.cpp b/ldmicro/contactsdialog.cpp
index 38750c8..7d13ff1 100644
--- a/ldmicro/contactsdialog.cpp
+++ b/ldmicro/contactsdialog.cpp
@@ -71,6 +71,22 @@ void ContactsDialogMyNameProc (GtkEditable *editable, gchar *NewText, gint lengt
}
}
+//Set the closing parameters
+
+gboolean ContactsDialogClosing(GtkWidget *widget, GdkEvent *event, gpointer user_data)
+{
+ DestroyWindow (ContactsDialog);
+ ProgramChanged();
+ gtk_widget_set_sensitive (MainWindow, TRUE);
+}
+
+gboolean ContactsDialogDestroyed(GtkWidget *widget, GdkEvent *event, gpointer user_data)
+{
+ DestroyWindow (ContactsDialog);
+ ProgramChanged();
+ gtk_widget_set_sensitive (MainWindow, TRUE);
+}
+
static void MakeControls(void)
{
SourceInternalRelayRadio = gtk_radio_button_new_with_label (NULL, "Internal Relay");
@@ -199,5 +215,7 @@ void ShowContactsDialog(BOOL *negated, char *name)
G_CALLBACK(ContactsDialogMouseClick), NULL);
g_signal_connect (G_OBJECT (CancelButton), "clicked",
G_CALLBACK(ContactsCallDestroyWindow), NULL);
+ g_signal_connect (ContactsDialog, "destroy_event", G_CALLBACK (ContactsDialogClosing), NULL);
+ g_signal_connect (ContactsDialog, "delete_event", G_CALLBACK (ContactsDialogDestroyed), NULL);
}
diff --git a/ldmicro/lutdialog.cpp b/ldmicro/lutdialog.cpp
index 04e7684..1bfe8c5 100644
--- a/ldmicro/lutdialog.cpp
+++ b/ldmicro/lutdialog.cpp
@@ -86,6 +86,24 @@ void LutDialogMyNumberProc (GtkEditable *editable, gchar *NewText, gint length,
}
}
+gboolean LutDialogClosing(GtkWidget *widget, GdkEvent *event, gpointer user_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;
+}
+
+gboolean LutDialogDestroyed(GtkWidget *widget, GdkEvent *event, gpointer user_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;
+}
+
//-----------------------------------------------------------------------------
// Don't allow any characters other than 0-9 in the count.
//-----------------------------------------------------------------------------
@@ -571,6 +589,8 @@ void ShowLookUpTableDialog(ElemLeaf *l)
G_CALLBACK(LutDialogOk), (gpointer)l);
g_signal_connect (G_OBJECT (CancelButton), "clicked",
G_CALLBACK(LutCallCancel), NULL);
+ g_signal_connect (LutDialog, "destroy_event", G_CALLBACK (LutDialogClosing), NULL);
+ g_signal_connect (LutDialog, "delete_event", G_CALLBACK (LutDialogDestroyed), NULL);
if (LUT_DIALOG_REFRESH_TIMER_ID_1 == 0)
LUT_DIALOG_REFRESH_TIMER_ID_1 = g_timeout_add(100, (GSourceFunc)LutDialogRefresh, (gpointer)l);
diff --git a/ldmicro/resetdialog.cpp b/ldmicro/resetdialog.cpp
index ff250df..8288eab 100644
--- a/ldmicro/resetdialog.cpp
+++ b/ldmicro/resetdialog.cpp
@@ -57,6 +57,20 @@ void ResetDialogMyNameProc (GtkEditable *editable, gchar *NewText, gint length,
}
}
+gboolean ResetDialogClosing(GtkWidget *widget, GdkEvent *event, gpointer user_data)
+{
+ DestroyWindow (ResetDialog);
+ ProgramChanged();
+ gtk_widget_set_sensitive (MainWindow, TRUE);
+}
+
+gboolean ResetDialogDestroyed(GtkWidget *widget, GdkEvent *event, gpointer user_data)
+{
+ DestroyWindow (ResetDialog);
+ ProgramChanged();
+ gtk_widget_set_sensitive (MainWindow, TRUE);
+}
+
static void MakeControls(void)
{
TypeTimerRadio = gtk_radio_button_new_with_label (NULL, "Timer");
@@ -156,4 +170,6 @@ void ShowResetDialog(char *name)
G_CALLBACK(ResetDialogMouseClick), (gpointer)name);
g_signal_connect (G_OBJECT (CancelButton), "clicked",
G_CALLBACK(ResetCallDestroyWindow), NULL);
+ g_signal_connect (ResetDialog, "destroy_event", G_CALLBACK (ResetDialogClosing), NULL);
+ g_signal_connect (ResetDialog, "delete_event", G_CALLBACK (ResetDialogDestroyed), NULL);
}
diff --git a/ldmicro/simpledialog.cpp b/ldmicro/simpledialog.cpp
index 65a5c43..601e7f8 100644
--- a/ldmicro/simpledialog.cpp
+++ b/ldmicro/simpledialog.cpp
@@ -98,7 +98,18 @@ static void MyAlnumOnlyProc (GtkEditable *editable, gchar *NewText, gint length,
gboolean SimpleDialogClosing(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
+ DestroyWindow(SimpleDialog);
+ ProgramChanged();
+ SIMPLE_DIALOG_ACTIVE = FALSE;
+ gtk_widget_set_sensitive (MainWindow, TRUE);
+}
+
+gboolean SimpleDialogDestroyed(GtkWidget *widget, GdkEvent *event, gpointer user_data)
+{
+ DestroyWindow(SimpleDialog);
+ ProgramChanged();
SIMPLE_DIALOG_ACTIVE = FALSE;
+ gtk_widget_set_sensitive (MainWindow, TRUE);
}
//-----------------------------------------------------------------------------
@@ -387,6 +398,7 @@ void ShowSimpleDialog(char *title, int boxes, char **labels, DWORD numOnlyMask,
g_signal_connect (OkButton, "clicked", G_CALLBACK (SimpleDialogWrapUp), NULL);
g_signal_connect (SimpleDialog, "key_press_event", G_CALLBACK (SimpleDialogKeyPressProc), NULL);
g_signal_connect (SimpleDialog, "destroy_event", G_CALLBACK (SimpleDialogClosing), NULL);
+ g_signal_connect (SimpleDialog, "delete_event", G_CALLBACK (SimpleDialogDestroyed), NULL);
// EnableWindow(MainWindow, FALSE);
// ShowWindow(SimpleDialog, TRUE);