summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ldmicro/lutdialog.cpp48
-rw-r--r--ldmicro/schematic.cpp21
2 files changed, 35 insertions, 34 deletions
diff --git a/ldmicro/lutdialog.cpp b/ldmicro/lutdialog.cpp
index c28f6d3..8c63f3b 100644
--- a/ldmicro/lutdialog.cpp
+++ b/ldmicro/lutdialog.cpp
@@ -58,8 +58,12 @@ static LONG_PTR PrevIndexProc;
static LONG_PTR PrevCountProc;
static HWID OkButton;
static HWID CancelButton;
+<<<<<<< HEAD
static int GLOBAL_LUT_DIALOG_TIMER;
static bool destroyCheck;
+=======
+static UINT LUT_DIALOG_REFRESH_TIMER_ID = 0;
+>>>>>>> akshay-c-GUI_port
HWID LutGrid;
HWID LutPackingBox;
@@ -436,24 +440,32 @@ gboolean LookUpTableKeyPress (HWID widget, GdkEventKey* event, gpointer data){
return FALSE;
}
-BOOL LutRefreshDialog (gpointer data){
+/// Dialog refresh function
+BOOL LutDialogRefresh(gpointer data)
+{
LookUpTableCheckMode ();
- LookUpTableGetData((gpointer) data);
+ LookUpTableGetData(NULL, (gpointer) data);
return TRUE;
}
-
-// Mouse click callback
-void LutDialogMouseClick (HWID widget, gpointer data){
- destroyCheck = TRUE;
+// Ok button call
+void LutDialogOk (HWID widget, gpointer data)
+{
LookUpTableCheckMode ();
- LookUpTableGetData((gpointer) data);
+ LookUpTableGetData(NULL, (gpointer) data);
+
+ DestroyWindow (LutDialog);
+ gtk_widget_set_sensitive (MainWindow, TRUE);
+ g_source_remove (LUT_DIALOG_REFRESH_TIMER_ID);
+ LUT_DIALOG_REFRESH_TIMER_ID = 0;
}
-// Calls DestroyWindow
-void LutCallDestroyWindow (HWID widget, gpointer data){
- // g_source_remove (GLOBAL_LUT_DIALOG_TIMER);
+// Cancel button call
+void LutCallCancel (HWID widget, gpointer data)
+{
DestroyWindow (LutDialog);
gtk_widget_set_sensitive (MainWindow, TRUE);
+ g_source_remove (LUT_DIALOG_REFRESH_TIMER_ID);
+ LUT_DIALOG_REFRESH_TIMER_ID = 0;
}
//-----------------------------------------------------------------------------
@@ -524,20 +536,12 @@ void ShowLookUpTableDialog(ElemLeaf *l)
g_signal_connect (G_OBJECT (LutDialog), "key-press-event",
G_CALLBACK(LookUpTableKeyPress), (gpointer)l);
g_signal_connect (G_OBJECT (OkButton), "clicked",
- G_CALLBACK(LutDialogMouseClick), (gpointer)l);
+ G_CALLBACK(LutDialogOk), (gpointer)l);
g_signal_connect (G_OBJECT (CancelButton), "clicked",
- G_CALLBACK(LutCallDestroyWindow), NULL);
- // GLOBAL_LUT_DIALOG_TIMER = g_timeout_add(100, (GSourceFunc)LutRefreshDialog, (gpointer)l);
-}
+ G_CALLBACK(LutCallCancel), NULL);
-gboolean PiecewiseDialogKeyPress (HWID widget,
- GdkEventKey* event, gpointer data){
- if (event->keyval = GDK_KEY_Return){
- PiecewiseDialogGetData();
- }
- else if (event->keyval = GDK_KEY_Return){
-
- }
+ if (LUT_DIALOG_REFRESH_TIMER_ID == 0)
+ LUT_DIALOG_REFRESH_TIMER_ID = g_timeout_add(100, (GSourceFunc)LutDialogRefresh, (gpointer)l);
}
//-----------------------------------------------------------------------------
diff --git a/ldmicro/schematic.cpp b/ldmicro/schematic.cpp
index f47a568..728a588 100644
--- a/ldmicro/schematic.cpp
+++ b/ldmicro/schematic.cpp
@@ -401,32 +401,29 @@ void MoveCursorKeyboard(int keyCode)
void EditSelectedElement(void)
{
-
- ShowContactsDialog(&(Selected->d.contacts.negated),Selected->d.contacts.name);
-
if(!Selected || Selected->selectedState == SELECTED_NONE) return;
switch(SelectedWhich) {
case ELEM_COMMENT:
- // ShowCommentDialog(Selected->d.comment.str);
+ ShowCommentDialog(Selected->d.comment.str);
break;
case ELEM_CONTACTS:
- // ShowContactsDialog(&(Selected->d.contacts.negated),
- // Selected->d.contacts.name);
+ ShowContactsDialog(&(Selected->d.contacts.negated),
+ Selected->d.contacts.name);
break;
case ELEM_COIL:
- // ShowCoilDialog(&(Selected->d.coil.negated),
- // &(Selected->d.coil.setOnly), &(Selected->d.coil.resetOnly),
- // Selected->d.coil.name);
+ ShowCoilDialog(&(Selected->d.coil.negated),
+ &(Selected->d.coil.setOnly), &(Selected->d.coil.resetOnly),
+ Selected->d.coil.name);
break;
case ELEM_TON:
case ELEM_TOF:
case ELEM_RTO:
// ShowTimerDialog(SelectedWhich, &(Selected->d.timer.delay),
- // Selected->d.timer.name);
+ // Selected->d.timer.name);
break;
case ELEM_CTU:
@@ -451,11 +448,11 @@ void EditSelectedElement(void)
case ELEM_MUL:
case ELEM_DIV:
// ShowMathDialog(SelectedWhich, Selected->d.math.dest,
- // Selected->d.math.op1, Selected->d.math.op2);
+ // Selected->d.math.op1, Selected->d.math.op2);
break;
case ELEM_RES:
- // ShowResetDialog(Selected->d.reset.name);
+ ShowResetDialog(Selected->d.reset.name);
break;
case ELEM_MOVE: