summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakshay-c2018-11-15 16:19:02 +0530
committerakshay-c2018-11-15 16:19:02 +0530
commit2459016302affaa26b23bf8df69da1092cf7b75a (patch)
treee7a5bc560f0bd00e6c4c9e741221de44131b7da5
parentdcc621a1b1e0a3425905a18fd665b21df8efcbd5 (diff)
downloadLDMicroGtk-2459016302affaa26b23bf8df69da1092cf7b75a.tar.gz
LDMicroGtk-2459016302affaa26b23bf8df69da1092cf7b75a.tar.bz2
LDMicroGtk-2459016302affaa26b23bf8df69da1092cf7b75a.zip
Prevent event Propagation during internal toggle
-rw-r--r--ldmicro/includes/ldmicro.h6
-rw-r--r--ldmicro/lib/linuxUI/linuxUI.cpp14
-rw-r--r--ldmicro/lib/linuxUI/linuxUI.h6
-rw-r--r--ldmicro/maincontrols.cpp16
4 files changed, 22 insertions, 20 deletions
diff --git a/ldmicro/includes/ldmicro.h b/ldmicro/includes/ldmicro.h
index 8bf490f..8c52775 100644
--- a/ldmicro/includes/ldmicro.h
+++ b/ldmicro/includes/ldmicro.h
@@ -121,6 +121,9 @@ typedef signed long SDWORD;
#define MNU_MANUAL 0x80
#define MNU_ABOUT 0x81
+#define MF_CHECKED 2
+#define MF_UNCHECKED 3
+
// #define MNU_ADV_SIMULATION
// New menu items here
@@ -600,6 +603,7 @@ extern McuIoInfo SupportedMcus[NUM_SUPPORTED_MCUS];
void CheckHeap(char *file, int line);
#define ok() CheckHeap(__FILE__, __LINE__)
+
// maincontrols.cpp
void MakeMainWindowControls(void);
HMENU MakeMainWindowMenus(void);
@@ -612,6 +616,8 @@ void ToggleSimulationMode(void);
void StopSimulation(void);
void StartSimulation(void);
void UpdateMainWindowTitleBar(void);
+gboolean LD_WM_Command_call(GtkMenuItem* men, gpointer gpcode);
+void CheckMenuItem(HMENU MenuName, HMENU MenuItem, UINT Check);
extern int ScrollWidth;
extern int ScrollHeight;
extern BOOL NeedHoriz;
diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp
index 0f6d09b..0a23282 100644
--- a/ldmicro/lib/linuxUI/linuxUI.cpp
+++ b/ldmicro/lib/linuxUI/linuxUI.cpp
@@ -20,8 +20,6 @@ std::vector<TimerRecord> timerRecords;
/// EnableMenuItem Variables
const UINT MF_ENABLED = 0;
const UINT MF_GRAYED = 1;
-const UINT MF_CHECKED = 2;
-const UINT MF_UNCHECKED = 3;
/// Accelerators (keyboard shortcuts)
GtkAccelGroup* AccelGroup;
@@ -244,18 +242,6 @@ void EnableMenuItem(HMENU MenuName, HMENU MenuItem, UINT CheckEnabledItem)
}
}
-void CheckMenuItem(HMENU MenuName, HMENU MenuItem, UINT Check)
-{
- switch (Check){
- case MF_CHECKED :
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(MenuItem), true);
- break;
- case MF_UNCHECKED :
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(MenuItem), false);
- break;
- }
-}
-
HANDLE GetStockObject(int fnObject)
{
switch(fnObject)
diff --git a/ldmicro/lib/linuxUI/linuxUI.h b/ldmicro/lib/linuxUI/linuxUI.h
index 53040ec..1b62935 100644
--- a/ldmicro/lib/linuxUI/linuxUI.h
+++ b/ldmicro/lib/linuxUI/linuxUI.h
@@ -112,8 +112,6 @@ extern const COLORREF DKGRAY_BR;
/// EnableMenuItem variables
extern const UINT MF_ENABLED;
extern const UINT MF_GRAYED;
-extern const UINT MF_CHECKED;
-extern const UINT MF_UNCHECKED;
/// Accelerators (keyboard shortcuts)
extern GtkAccelGroup* AccelGroup;
@@ -169,10 +167,6 @@ void EnableMenuItem(
HMENU MenuItem,
UINT CheckEnabledItem);
-void CheckMenuItem(
- HMENU MenuName,
- HMENU MenuItem,
- UINT Check);
HANDLE GetStockObject(int fnObject);
diff --git a/ldmicro/maincontrols.cpp b/ldmicro/maincontrols.cpp
index 9974f2e..11795fc 100644
--- a/ldmicro/maincontrols.cpp
+++ b/ldmicro/maincontrols.cpp
@@ -135,6 +135,22 @@ int IoListTop;
// whether the simulation is running in real time
static BOOL RealTimeSimulationRunning;
+void CheckMenuItem(HMENU MenuName, HMENU MenuItem, UINT Check)
+{
+ g_signal_handlers_block_matched(MenuItem, G_SIGNAL_MATCH_FUNC,NULL,NULL,NULL,
+ (void*)LD_WM_Command_call, (void*)NULL);
+ switch (Check){
+ case MF_CHECKED :
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(MenuItem), true);
+ break;
+ case MF_UNCHECKED :
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM(MenuItem), false);
+ break;
+ }
+ g_signal_handlers_unblock_matched(G_OBJECT(MenuItem), G_SIGNAL_MATCH_FUNC,NULL,NULL,NULL,
+ (void*)LD_WM_Command_call, GINT_TO_POINTER(MNU_SIMULATION_MODE));
+}
+
// Displaying keyboard shortcuts for each menu item
void AddMenuAccelerators (void){
// Declaring the accelerator group for keyboard shortcuts