summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakshay-c2019-05-16 10:41:48 +0530
committerakshay-c2019-05-16 10:41:48 +0530
commit3f7c4198a528cda5f027d26d103a8b228e82474b (patch)
tree4791c99ced6788bd662629d9d6ed6638c28d7be9
parent6435315d982440fed60c8a9487f4de20296ccb2f (diff)
downloadLDmicroQt-3f7c4198a528cda5f027d26d103a8b228e82474b.tar.gz
LDmicroQt-3f7c4198a528cda5f027d26d103a8b228e82474b.tar.bz2
LDmicroQt-3f7c4198a528cda5f027d26d103a8b228e82474b.zip
Fixed Menu Keyboard Shortcuts issue for Vidyut running Ubuntu14 and compile successful message box
-rw-r--r--ldmicro/CMakeLists.txt14
-rw-r--r--ldmicro/maincontrols.cpp59
-rw-r--r--ldmicro/miscutil.cpp6
3 files changed, 75 insertions, 4 deletions
diff --git a/ldmicro/CMakeLists.txt b/ldmicro/CMakeLists.txt
index 66cd49c..12fb4e5 100644
--- a/ldmicro/CMakeLists.txt
+++ b/ldmicro/CMakeLists.txt
@@ -30,6 +30,18 @@ IF(UNIX)
add_definitions ("-g")
add_definitions(-D__UNIX__)
add_definitions(-DLDLANG_EN)
+ execute_process(COMMAND lsb_release -cs
+ OUTPUT_VARIABLE RELEASE_CODENAME
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ STRING(TOLOWER ${RELEASE_CODENAME} RELEASE_LOWER)
+ message("-- os_version_suffix:${RELEASE_CODENAME}")
+ if(${RELEASE_LOWER} MATCHES "trusty")
+ MESSAGE("Add flag to compile for Ubuntu 14")
+ add_definitions(-D__UBUNTU_14_)
+ else()
+ MESSAGE("Add flag to compile for Ubuntu 16 and above")
+ add_definitions(-D__UBUNTU_16_)
+ endif()
use_cxx14()
# set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/build/")
@@ -125,7 +137,7 @@ endif()
compilecommon.cpp
intcode.cpp
lang.cpp
- miscutil.cpp #add message boxes to Error(), CompileSuccessfulMessage()
+ miscutil.cpp
iolist.cpp
confdialog.cpp
lutdialog.cpp
diff --git a/ldmicro/maincontrols.cpp b/ldmicro/maincontrols.cpp
index 8bd128f..f238c4a 100644
--- a/ldmicro/maincontrols.cpp
+++ b/ldmicro/maincontrols.cpp
@@ -140,6 +140,62 @@ int IoListTop;
static BOOL RealTimeSimulationRunning;
//-----------------------------------------------------------------------------
+// Ubuntu 14 on Vidyut does not handle Menu Shortcuts.
+// This function adds corresponding action for the shortcuts to the MainWindow
+//-----------------------------------------------------------------------------
+#if defined(__UBUNTU_14_)
+ inline void SetKeyboardShortcuts()
+ {
+ MainWindow->addAction(NewMenu);
+ MainWindow->addAction(OpenMenu);
+ MainWindow->addAction(SaveMenu);
+ MainWindow->addAction(SaveAsMenu);
+ MainWindow->addAction(ExportMenu);
+ MainWindow->addAction(UndoMenu);
+ MainWindow->addAction(RedoMenu);
+ MainWindow->addAction(InsertRungBeforeMenu);
+ MainWindow->addAction(InsertRungAfterMenu);
+ MainWindow->addAction(PushRungUpMenu);
+ MainWindow->addAction(PushRungDownMenu);
+ MainWindow->addAction(DeleteElementMenu);
+ MainWindow->addAction(DeleteRungMenu);
+ MainWindow->addAction(InsertCommentMenu);
+ MainWindow->addAction(InsertContactsMenu);
+ MainWindow->addAction(InsertOsrMenu);
+ MainWindow->addAction(InsertOsfMenu);
+ MainWindow->addAction(InsertTonMenu);
+ MainWindow->addAction(InsertTofMenu);
+ MainWindow->addAction(InsertRtoMenu);
+ MainWindow->addAction(InsertCtuMenu);
+ MainWindow->addAction(InsertCtdMenu);
+ MainWindow->addAction(InsertCtcMenu);
+ MainWindow->addAction(InsertEquMenu);
+ MainWindow->addAction(InsertGrtMenu);
+ MainWindow->addAction(InsertGeqMenu);
+ MainWindow->addAction(InsertLesMenu);
+ MainWindow->addAction(InsertLeqMenu);
+ MainWindow->addAction(InsertCoilMenu);
+ MainWindow->addAction(InsertResMenu);
+ MainWindow->addAction(InsertMovMenu);
+ MainWindow->addAction(InsertAddMenu);
+ MainWindow->addAction(InsertSubMenu);
+ MainWindow->addAction(InsertMulMenu);
+ MainWindow->addAction(InsertDivMenu);
+ MainWindow->addAction(InsertReadAdcMenu);
+ MainWindow->addAction(MakeNormalMenu);
+ MainWindow->addAction(NegateMenu);
+ MainWindow->addAction(MakeSetOnlyMenu);
+ MainWindow->addAction(MakeResetOnlyMenu);
+ MainWindow->addAction(CompileMenu);
+ MainWindow->addAction(ManualMenu);
+ MainWindow->addAction(SimulationModeMenu);
+ MainWindow->addAction(StartSimulationMenu);
+ MainWindow->addAction(StopSimulationMenu);
+ MainWindow->addAction(SingleCycleMenu);
+ }
+#endif
+
+//-----------------------------------------------------------------------------
// Create the top-level menu bar for the main window. Mostly static, but we
// create the "select processor" menu from the list in mcutable.h dynamically.
//-----------------------------------------------------------------------------
@@ -411,6 +467,9 @@ HMENU MakeMainWindowMenus(void)
MainMenu->addMenu(SimulateMenu);
MainMenu->addMenu(Compile);
MainMenu->addMenu(Help);
+ #if defined(__UBUNTU_14_)
+ SetKeyboardShortcuts();
+ #endif
return FileMenu;
}
diff --git a/ldmicro/miscutil.cpp b/ldmicro/miscutil.cpp
index 77b2791..2a9b6f1 100644
--- a/ldmicro/miscutil.cpp
+++ b/ldmicro/miscutil.cpp
@@ -117,10 +117,10 @@ void CompileSuccessfulMessage(char *str)
//AttachConsoleDynamic(ATTACH_PARENT_PROCESS);
//HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
//DWORD written;
- //riteFile(h, str, strlen(str), &written, NULL);
+ //WriteFile(h, str, strlen(str), &written, NULL);
} else {
- // MessageBox(MainWindow, str, _("Compile Successful"),
- // MB_OK | MB_ICONINFORMATION);
+ MessageBox(MainWindow, str, _("Compile Successful"),
+ MB_OK, MB_ICONINFORMATION);
}
}