diff options
-rw-r--r-- | ldmicro/lutdialog.cpp | 32 | ||||
-rw-r--r-- | ldmicro/schematic.cpp | 21 |
2 files changed, 35 insertions, 18 deletions
diff --git a/ldmicro/lutdialog.cpp b/ldmicro/lutdialog.cpp index 188b1a8..7bda806 100644 --- a/ldmicro/lutdialog.cpp +++ b/ldmicro/lutdialog.cpp @@ -58,6 +58,7 @@ static LONG_PTR PrevIndexProc; static LONG_PTR PrevCountProc; static HWID OkButton; static HWID CancelButton; +static UINT LUT_DIALOG_REFRESH_TIMER_ID = 0; HWID LutGrid; HWID LutPackingBox; @@ -437,16 +438,32 @@ gboolean LookUpTableKeyPress (HWID widget, GdkEventKey* event, gpointer data){ return FALSE; } -// Mouse click callback -void LutDialogMouseClick (HWID widget, gpointer data){ +/// Dialig refresh function +BOOL LutDialogRefresh(gpointer data) +{ LookUpTableCheckMode (); LookUpTableGetData(NULL, (gpointer) data); + return TRUE; } +// Ok button call +void LutDialogOk (HWID widget, gpointer data) +{ + LookUpTableCheckMode (); + LookUpTableGetData(NULL, (gpointer) data); -// Calls DestroyWindow -void LutCallDestroyWindow (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; +} + +// 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; } //----------------------------------------------------------------------------- @@ -519,9 +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); + G_CALLBACK(LutCallCancel), NULL); + + 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: |