diff options
author | NatsuDrag9 | 2018-06-26 12:16:34 +0530 |
---|---|---|
committer | NatsuDrag9 | 2018-06-26 12:16:34 +0530 |
commit | 538505b2cd1cc4a93414970f2e6e1af99bde3020 (patch) | |
tree | 87351ce297aefc8947058ad4b95f27dbab79d2e5 /ldmicro | |
parent | 794e1074287fbc82a8e3d1e873222160a1b256f6 (diff) | |
download | LDMicroGtk-538505b2cd1cc4a93414970f2e6e1af99bde3020.tar.gz LDMicroGtk-538505b2cd1cc4a93414970f2e6e1af99bde3020.tar.bz2 LDMicroGtk-538505b2cd1cc4a93414970f2e6e1af99bde3020.zip |
Ported contactsdialog.cpp and resetdialog.cpp
Diffstat (limited to 'ldmicro')
-rw-r--r-- | ldmicro/contactsdialog.cpp | 21 | ||||
-rw-r--r-- | ldmicro/lib/linuxUI/linuxUI.cpp | 1 | ||||
-rw-r--r-- | ldmicro/resetdialog.cpp | 22 |
3 files changed, 27 insertions, 17 deletions
diff --git a/ldmicro/contactsdialog.cpp b/ldmicro/contactsdialog.cpp index 9b6c8ff..2f34c08 100644 --- a/ldmicro/contactsdialog.cpp +++ b/ldmicro/contactsdialog.cpp @@ -125,13 +125,20 @@ void ContactsDialogGetData (BOOL* negated, char* name){ else { name[0] = 'Y'; } - strcpy (name, gtk_entry_get_text (GTK_ENTRY (NameTextbox))); + strcpy (name+1, gtk_entry_get_text (GTK_ENTRY (NameTextbox))); // ******** Check this ******* // SendMessage(NameTextbox, WM_GETTEXT, (WPARAM)16, (LPARAM)(name+1)); + DestroyWindow (ContactsDialog, NULL); + gtk_widget_set_sensitive (MainWindow, TRUE); +} + +// Mouse click callback +void ContactsDialogMouseClick(HWID widget, gpointer data){ + ContactsDialogGetData(tmpnegated, tmpname); } // Checks for the required key press -gboolean ContactsDialogKeyPress (GtkWidget* widget, GdkEventKey* event, gpointer data){ +gboolean ContactsDialogKeyPress (HWID widget, GdkEventKey* event, gpointer data){ if (event -> keyval == GDK_KEY_Return){ ContactsDialogGetData(tmpnegated, tmpname); } @@ -163,26 +170,20 @@ void ShowContactsDialog(BOOL *negated, char *name) MakeControls(); if(name[0] == 'R') { - // SendMessage(SourceInternalRelayRadio, BM_SETCHECK, BST_CHECKED, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (SourceInternalRelayRadio), TRUE); } else if(name[0] == 'Y') { - // SendMessage(SourceOutputPinRadio, BM_SETCHECK, BST_CHECKED, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (SourceOutputPinRadio), TRUE); } else { - // SendMessage(SourceInputPinRadio, BM_SETCHECK, BST_CHECKED, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (SourceInputPinRadio), TRUE); } if(*negated) { - // SendMessage(NegatedCheckbox, BM_SETCHECK, BST_CHECKED, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (NegatedCheckbox), TRUE); } - // SendMessage(NameTextbox, WM_SETTEXT, 0, (LPARAM)(name + 1)); - // ************What does name+1 mean in original file??*************** gtk_entry_set_text (GTK_ENTRY (NameTextbox), name + 1); - gtk_widget_set_sensitive (MainWindow, TRUE); + gtk_widget_set_sensitive (MainWindow, FALSE); gtk_widget_show_all (ContactsDialog); gtk_widget_grab_focus (NameTextbox); tmpname = name; @@ -193,7 +194,7 @@ void ShowContactsDialog(BOOL *negated, char *name) g_signal_connect (G_OBJECT (ContactsDialog), "key-press-event", G_CALLBACK(ContactsDialogKeyPress), NULL); g_signal_connect (G_OBJECT (OkButton), "clicked", - G_CALLBACK(ContactsDialogGetData), NULL); + G_CALLBACK(ContactsDialogMouseClick), NULL); g_signal_connect (G_OBJECT (CancelButton), "clicked", G_CALLBACK(ContactsCallDestroyWindow), NULL); diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp index b57d4d0..5b87a60 100644 --- a/ldmicro/lib/linuxUI/linuxUI.cpp +++ b/ldmicro/lib/linuxUI/linuxUI.cpp @@ -482,6 +482,7 @@ BOOL GetWindowRect(HWID hWid, PRECT pRect) void DestroyWindow (GtkWidget* widget, gpointer data){ gtk_widget_destroy (widget); } + UINT SetTimer(HWID hWid, UINT nIDEvent, UINT uElapse, BOOL (*lpTimerFunc)(BOOL) ) { auto record_it = std::find_if(timerRecords.begin(), timerRecords.end(), [&nIDEvent](TimerRecord &Record) { return Record.ufID == nIDEvent; }); diff --git a/ldmicro/resetdialog.cpp b/ldmicro/resetdialog.cpp index 04c224e..4fdb9cd 100644 --- a/ldmicro/resetdialog.cpp +++ b/ldmicro/resetdialog.cpp @@ -24,9 +24,11 @@ #include "linuxUI.h" #include <stdio.h> //#include <commctrl.h> - +#include <iostream> #include "ldmicro.h" +using namespace std; + static HWID ResetDialog; static HWID TypeTimerRadio; @@ -91,11 +93,18 @@ void ResetDialogGetData (char* name){ else { name[0] = 'C'; } - strcpy (name, gtk_entry_get_text (GTK_ENTRY (NameTextbox))); + strcpy (name+1, gtk_entry_get_text (GTK_ENTRY (NameTextbox))); + gtk_widget_set_sensitive (MainWindow, TRUE); + DestroyWindow (ResetDialog, NULL); +} + +// Mouse click callback +void ResetDialogMouseClick (HWID widget, gpointer data){ + ResetDialogGetData((char*)data); } // Checks for the required key press -gboolean ResetDialogKeyPress (GtkWidget* widget, GdkEventKey* event, gpointer data){ +gboolean ResetDialogKeyPress (HWID widget, GdkEventKey* event, gpointer data){ if (event -> keyval == GDK_KEY_Return){ ResetDialogGetData((char*)data); } @@ -132,10 +141,9 @@ void ShowResetDialog(char *name) else { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (TypeCounterRadio), TRUE); } - // ************What does name+1 mean in original file??*************** - gtk_entry_set_text (GTK_ENTRY (NameTextbox), name + 1); + gtk_entry_set_text (GTK_ENTRY (NameTextbox), name+1); - gtk_widget_set_sensitive (MainWindow, TRUE); + gtk_widget_set_sensitive (MainWindow, FALSE); gtk_widget_show_all (ResetDialog); gtk_widget_grab_focus (NameTextbox); @@ -144,7 +152,7 @@ void ShowResetDialog(char *name) g_signal_connect (G_OBJECT (ResetDialog), "key-press-event", G_CALLBACK(ResetDialogKeyPress), (gpointer)name); g_signal_connect (G_OBJECT (OkButton), "clicked", - G_CALLBACK(ResetDialogGetData), (gpointer)name); + G_CALLBACK(ResetDialogMouseClick), (gpointer)name); g_signal_connect (G_OBJECT (CancelButton), "clicked", G_CALLBACK(ResetCallDestroyWindow), NULL); } |