diff options
-rw-r--r-- | ldmicro/CMakeLists.txt | 10 | ||||
-rw-r--r-- | ldmicro/circuit.cpp | 2 | ||||
-rw-r--r-- | ldmicro/confdialog.cpp | 2 | ||||
-rw-r--r-- | ldmicro/draw.cpp | 4 | ||||
-rw-r--r-- | ldmicro/helpdialog.cpp | 2 | ||||
-rw-r--r-- | ldmicro/ldmicro.cpp | 6 | ||||
-rw-r--r-- | ldmicro/lib/linuxUI/linuxLD.cpp | 33 | ||||
-rw-r--r-- | ldmicro/lib/linuxUI/linuxLD.h | 12 | ||||
-rw-r--r-- | ldmicro/lib/linuxUI/linuxUI.cpp | 66 | ||||
-rw-r--r-- | ldmicro/lib/linuxUI/linuxUI.h | 25 | ||||
-rw-r--r-- | ldmicro/lutdialog.cpp | 2 | ||||
-rw-r--r-- | ldmicro/maincontrols.cpp | 32 | ||||
-rw-r--r-- | ldmicro/miscutil.cpp | 2 | ||||
-rw-r--r-- | ldmicro/resetdialog.cpp | 2 | ||||
-rw-r--r-- | ldmicro/schematic.cpp | 2 | ||||
-rw-r--r-- | ldmicro/simulate.cpp | 2 | ||||
-rw-r--r-- | ldmicro/undoredo.cpp | 2 |
17 files changed, 56 insertions, 150 deletions
diff --git a/ldmicro/CMakeLists.txt b/ldmicro/CMakeLists.txt index 2337bcb..7010ced 100644 --- a/ldmicro/CMakeLists.txt +++ b/ldmicro/CMakeLists.txt @@ -2,17 +2,17 @@ cmake_minimum_required(VERSION 2.6) project(LDMicro) -macro(use_cxx11) +macro(use_cxx14) if (CMAKE_VERSION VERSION_LESS "3.1") if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++14") endif () else () - set (CMAKE_CXX_STANDARD 11) + set (CMAKE_CXX_STANDARD 14) endif () -endmacro(use_cxx11) +endmacro(use_cxx14) IF(WIN32) MESSAGE( FATAL_ERROR "Cannot build for windows, exiting" ) @@ -30,7 +30,7 @@ IF(UNIX) add_definitions ("-g") add_definitions(-D__UNIX__) add_definitions(-DLDLANG_EN) - use_cxx11() + use_cxx14() # set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/build/") diff --git a/ldmicro/circuit.cpp b/ldmicro/circuit.cpp index 0b95327..2868fe2 100644 --- a/ldmicro/circuit.cpp +++ b/ldmicro/circuit.cpp @@ -28,8 +28,6 @@ #include "ldmicro.h" -using namespace std; - static ElemSubcktSeries *LoadSeriesFromFile(FILE *f); //----------------------------------------------------------------------------- diff --git a/ldmicro/confdialog.cpp b/ldmicro/confdialog.cpp index f63fae9..d7eee19 100644 --- a/ldmicro/confdialog.cpp +++ b/ldmicro/confdialog.cpp @@ -29,8 +29,6 @@ //#include <commctrl.h> #include "ldmicro.h" -using namespace std; - static QDialog* ConfDialog; static QLineEdit* CrystalTextbox; diff --git a/ldmicro/draw.cpp b/ldmicro/draw.cpp index b3bec06..fd16b97 100644 --- a/ldmicro/draw.cpp +++ b/ldmicro/draw.cpp @@ -24,8 +24,8 @@ // Jonathan Westhues, Oct 2004 //----------------------------------------------------------------------------- #include "linuxUI.h" -#include <stdio.h> -#include <stdlib.h> +// #include <stdio.h> +// #include <stdlib.h> #include "ldmicro.h" diff --git a/ldmicro/helpdialog.cpp b/ldmicro/helpdialog.cpp index 9bd28e1..8317e52 100644 --- a/ldmicro/helpdialog.cpp +++ b/ldmicro/helpdialog.cpp @@ -32,8 +32,6 @@ #include "ldmicro.h" -using namespace std; - extern char *HelpText[]; extern char *HelpTextDe[]; extern char *HelpTextFr[]; diff --git a/ldmicro/ldmicro.cpp b/ldmicro/ldmicro.cpp index ee11faa..fbf2b3d 100644 --- a/ldmicro/ldmicro.cpp +++ b/ldmicro/ldmicro.cpp @@ -34,10 +34,6 @@ #include <iomanip> #include <iostream> #include <QPushButton> -// #include <qapplication> - -using namespace std; - HINSTANCE Instance; QApplication* LDmicroApp; @@ -940,7 +936,7 @@ void PaintWidget :: mouseDoubleClickEvent(QMouseEvent* event) { QRect Rect; Rect = DrawWindow->rect(); - QPoint wy = DrawWindow->mapFrom(MainWindow, event->pos()); + QPoint wy = event->pos(); if((wy.x() <= 0) || (wy.y() <= 0)) return; diff --git a/ldmicro/lib/linuxUI/linuxLD.cpp b/ldmicro/lib/linuxUI/linuxLD.cpp index d43fd0e..9fa63c9 100644 --- a/ldmicro/lib/linuxUI/linuxLD.cpp +++ b/ldmicro/lib/linuxUI/linuxLD.cpp @@ -1,8 +1,6 @@ #include "linuxUI.h" #include <iostream> -using namespace std; - std::vector<HEAPRECORD> HeapRecords; HANDLE HeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize) @@ -24,6 +22,14 @@ HANDLE HeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize) return hHeap; } +size_t max(size_t A, size_t B) +{ + if(A>B) + return A; + else + return B; +} + LPVOID HeapAlloc(HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes) { // if (hHeap == NULL) @@ -102,7 +108,7 @@ BOOL HeapFree(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem) } -HICON LoadImage(HINSTANCE hinst, LPCTSTR lpszName, UINT uType, int cxDesired, +/*HICON LoadImage(HINSTANCE hinst, LPCTSTR lpszName, UINT uType, int cxDesired, int cyDesired, UINT fuLoad) { HICON pixbuf; @@ -115,26 +121,27 @@ HICON LoadImage(HINSTANCE hinst, LPCTSTR lpszName, UINT uType, int cxDesired, } return pixbuf; -} +}*/ -void RECT_to_GDRECT(const RECT *rc, GDRECT *gdrc) -{ - // gdrc->x = rc->left; - // gdrc->y = rc->top; - // gdrc->width = rc->right - rc->left; - // gdrc->height = rc->bottom - rc->top; -} void OutputDebugString(char* str) { } -double GetTickCount(void) +/*double GetTickCount(void) { // timespec now; // clock_gettime() // if (clock_gettime(CLOCK_MONOTONIC, &now)) // return 0; return 10.2;//now.tv_sec * 1000.0 + now.tv_nsec / 1000000.0; -} +}*/ +double GetTickCount(void) +{ + timespec now; + if (clock_gettime(CLOCK_MONOTONIC, &now)) + return 0; + return now.tv_sec * 1000.0 + now.tv_nsec / 1000000.0; + +}
\ No newline at end of file diff --git a/ldmicro/lib/linuxUI/linuxLD.h b/ldmicro/lib/linuxUI/linuxLD.h index edaead8..231e499 100644 --- a/ldmicro/lib/linuxUI/linuxLD.h +++ b/ldmicro/lib/linuxUI/linuxLD.h @@ -11,6 +11,7 @@ #include <QSplitter> #include <Qt> #include <sys/mman.h> +#include <iostream> /// common windows referances for linux @@ -28,7 +29,14 @@ #define LDMICRO_ICON "../ldmicro.ico" /// Macro functions -#define max(_A, _B) std::max(_A, _B) +// #define max(_A, _B) std::max(_A, _B) + +/*#define max(_A, _B) { \ + if((_A) > (_B)) \ + return (_A); \ + else \ + return (_B); \ + }*/ /// Typedefs //typedef int64_t __int64; @@ -247,4 +255,6 @@ void RECT_to_GDRECT( void OutputDebugString(char*); double GetTickCount(void); +size_t max(size_t A, size_t B); + #endif
\ No newline at end of file diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp index dc2dc8b..eca0b50 100644 --- a/ldmicro/lib/linuxUI/linuxUI.cpp +++ b/ldmicro/lib/linuxUI/linuxUI.cpp @@ -23,10 +23,6 @@ const UINT MF_GRAYED = 1; const UINT MF_CHECKED = 2; const UINT MF_UNCHECKED = 3; -/// Accelerators (keyboard shortcuts) -GtkAccelGroup* AccelGroup; -GClosure* closure; - /// ListStore HWID view; HTVC column; @@ -395,59 +391,6 @@ int FillRect(HCRDC hDC, const QRect *lprc, HBRUSH hbr) return 0; } -BOOL PatBlt(HWID hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, DWORD dwRop, HBRUSH hbr) -{ - if (hdc == NULL) - return FALSE; - - //cairo_set_source_rgb(hdc, hbr->red, hbr->green, hbr->blue); - //cairo_rectangle(hdc, nXLeft, nYLeft + 20, nWidth, nHeight); - //cairo_stroke_preserve(hdc); - - //cairo_fill(hdc); - - return TRUE; -} - -BOOL GetClientRect(HWID hWid, PRECT pRect) -{ - /* GtkAllocation allocation; - gtk_widget_get_allocation (hWid, &allocation); - - pRect->top = allocation.x; - pRect->left = allocation.y; - pRect->right = allocation.width; - pRect->bottom = allocation.height; -*/ - return TRUE; -} - -BOOL MoveWindow(HWID hWid, int X, int Y, int nWidth, int nHeight, BOOL bRepaint) -{ - /* gtk_window_move(GTK_WINDOW(hWid), X, Y); - gtk_window_resize(GTK_WINDOW(hWid), nWidth, nHeight); - - if (bRepaint) - gdk_window_invalidate_rect (gtk_widget_get_window (hWid), NULL, FALSE); - */ - return TRUE; -} - - -BOOL GetWindowRect(HWID hWid, PRECT pRect) -{ - /*GtkAllocation allocation; - gtk_widget_get_allocation (hWid, &allocation); - - pRect->top = allocation.x; - pRect->left = allocation.y; - pRect->right = allocation.width; - pRect->bottom = allocation.height; -*/ - return TRUE; -} - - UINT SetTimer(HWID hWid, UINT nIDEvent, UINT uElapse, UINT TimerID) { if(TimerID != NULL) @@ -518,12 +461,3 @@ BOOL KillTimer(HWID hWid, UINT uIDEvent) return TRUE; } -/*void DestroyWindow (HWID widget) -{ - if (GTK_IS_WIDGET(widget)) - { - gtk_widget_destroy (widget); - } -}*/ - - diff --git a/ldmicro/lib/linuxUI/linuxUI.h b/ldmicro/lib/linuxUI/linuxUI.h index 136de4e..629ede6 100644 --- a/ldmicro/lib/linuxUI/linuxUI.h +++ b/ldmicro/lib/linuxUI/linuxUI.h @@ -276,31 +276,6 @@ int FillRect( const QRect *lprc, HBRUSH hbr); -BOOL PatBlt( - HWID hdc, - int nXLeft, - int nYLeft, - int nWidth, - int nHeight, - DWORD dwRop, - HBRUSH hbr); - -BOOL GetClientRect( - HWID hWid, - PRECT lpRect); - -BOOL MoveWindow( - HWID hWid, - int X, - int Y, - int nWidth, - int nHeight, - BOOL bRepaint); - -BOOL GetWindowRect( - HWID hWid, - PRECT pRect); - UINT SetTimer( HWID hWid, UINT nIDEvent, diff --git a/ldmicro/lutdialog.cpp b/ldmicro/lutdialog.cpp index e244d1a..17e6e5b 100644 --- a/ldmicro/lutdialog.cpp +++ b/ldmicro/lutdialog.cpp @@ -31,8 +31,6 @@ #include "ldmicro.h" -using namespace std; - static QDialog* LutDialog; static QCheckBox* AsStringCheckbox; diff --git a/ldmicro/maincontrols.cpp b/ldmicro/maincontrols.cpp index 0c520ae..b1b1f9d 100644 --- a/ldmicro/maincontrols.cpp +++ b/ldmicro/maincontrols.cpp @@ -276,18 +276,18 @@ HMENU MakeMainWindowMenus(void) Help = new QMenu("&Help", MainWindow); // Creating labels for File Menu - NewMenu = new QAction("&New"); + NewMenu = new QAction("&New", NULL); NewMenu->setShortcuts(QKeySequence::New); // QKeySequence(Qt::CTRL + Qt::Key_N); - OpenMenu = new QAction("&Open"); + OpenMenu = new QAction("&Open", NULL); OpenMenu->setShortcuts(QKeySequence::Open); - SaveMenu = new QAction("&Save"); + SaveMenu = new QAction("&Save", NULL); SaveMenu->setShortcuts(QKeySequence::Save); - SaveAsMenu = new QAction("&Save As"); + SaveAsMenu = new QAction("&Save As", NULL); SaveAsMenu->setShortcuts(QKeySequence::SaveAs); - ExportMenu = new QAction("&Export As Text"); + ExportMenu = new QAction("&Export As Text", NULL); ExportMenu->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E)); - ExitMenu = new QAction("&Exit"); + ExitMenu = new QAction("&Exit", NULL); // Appending menu items (labels) to File menu and adding separators FileMenu->addAction(NewMenu); @@ -300,21 +300,21 @@ HMENU MakeMainWindowMenus(void) FileMenu->addAction(ExitMenu); // Creating labels for Edit Menu - UndoMenu = new QAction("&Undo"); + UndoMenu = new QAction("&Undo", NULL); UndoMenu->setShortcuts(QKeySequence::Undo); - RedoMenu = new QAction("&Redo"); + RedoMenu = new QAction("&Redo", NULL); RedoMenu->setShortcuts(QKeySequence::Redo); - InsertRungBeforeMenu = new QAction("&Insert Rung Before"); + InsertRungBeforeMenu = new QAction("&Insert Rung Before", NULL); InsertRungBeforeMenu->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_6)); - InsertRungAfterMenu = new QAction("&Insert Rung After"); + InsertRungAfterMenu = new QAction("&Insert Rung After", NULL); InsertRungAfterMenu->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_V)); - PushRungUpMenu = new QAction("&Move Selected Rung Up");; + PushRungUpMenu = new QAction("&Move Selected Rung Up", NULL); PushRungUpMenu->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Up)); - PushRungDownMenu = new QAction("&Move Selected Rung Down");; + PushRungDownMenu = new QAction("&Move Selected Rung Down", NULL); PushRungDownMenu->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Down)); - DeleteElementMenu = new QAction("&Delete Selected Element"); + DeleteElementMenu = new QAction("&Delete Selected Element", NULL); DeleteElementMenu->setShortcut(QKeySequence(Qt::Key_Delete)); - DeleteRungMenu = new QAction("&Delete Rung"); + DeleteRungMenu = new QAction("&Delete Rung", NULL); DeleteRungMenu->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Delete)); // Appending menu items to Edit menu and adding separators @@ -339,14 +339,14 @@ HMENU MakeMainWindowMenus(void) Settings->addMenu(MicroControllerMenu); // Appending the microcontroller names to "Microcontroller" item for (i = 0; i < NUM_SUPPORTED_MCUS; i++){ - ProcessorMenuItems[i] = new QAction(SupportedMcus[i].mcuName); + ProcessorMenuItems[i] = new QAction(SupportedMcus[i].mcuName, NULL); ProcessorMenuItems[i]->setCheckable(true); ProcessorMenuItems[i]->setActionGroup(ProcessorMenuGroup); MicroControllerMenu->addAction(ProcessorMenuItems[i]); /*mcuList = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (ProcessorMenuItems[i])); gtk_menu_shell_append (GTK_MENU_SHELL (ProcessorMenu), ProcessorMenuItems[i]);*/ } - ProcessorMenuItems[i] = new QAction("(no microcontroller)"); + ProcessorMenuItems[i] = new QAction("(no microcontroller)", NULL); ProcessorMenuItems[i]->setCheckable(true); ProcessorMenuItems[i]->setActionGroup(ProcessorMenuGroup); MicroControllerMenu->addAction(ProcessorMenuItems[i]); diff --git a/ldmicro/miscutil.cpp b/ldmicro/miscutil.cpp index d9ec34e..41eda28 100644 --- a/ldmicro/miscutil.cpp +++ b/ldmicro/miscutil.cpp @@ -26,8 +26,6 @@ #include <iostream> #include "ldmicro.h" -using namespace std; - // We should display messages to the user differently if we are running // interactively vs. in batch (command-line) mode. BOOL RunningInBatchMode = FALSE; diff --git a/ldmicro/resetdialog.cpp b/ldmicro/resetdialog.cpp index 5764730..54df78c 100644 --- a/ldmicro/resetdialog.cpp +++ b/ldmicro/resetdialog.cpp @@ -27,8 +27,6 @@ #include <iostream> #include "ldmicro.h" -using namespace std; - static QDialog* ResetDialog; static QRadioButton* TypeTimerRadio; diff --git a/ldmicro/schematic.cpp b/ldmicro/schematic.cpp index d9a9217..003f346 100644 --- a/ldmicro/schematic.cpp +++ b/ldmicro/schematic.cpp @@ -28,8 +28,6 @@ #include "ldmicro.h" -using namespace std; - // Not all options all available e.g. can't delete the only relay coil in // a rung, can't insert two coils in series, etc. Keep track of what is // allowed so we don't corrupt our program. diff --git a/ldmicro/simulate.cpp b/ldmicro/simulate.cpp index 0bb4fec..6c25e49 100644 --- a/ldmicro/simulate.cpp +++ b/ldmicro/simulate.cpp @@ -938,7 +938,7 @@ void ShowUartSimulationWindow(void) UartSimulationWindow->setWindowFlags(Qt::Window | Qt::WindowMinimizeButtonHint | Qt::WindowStaysOnTopHint); - UartSimulationWindow->setAttribute(Qt::WA_AlwaysStackOnTop); + UartSimulationWindow->setWindowFlags(Qt::Tool); UartSimulationTextControl = new QPlainTextEdit(); UartSimulationTextControl->resize(TerminalW, TerminalH); diff --git a/ldmicro/undoredo.cpp b/ldmicro/undoredo.cpp index 8bcfcc8..3f9407a 100644 --- a/ldmicro/undoredo.cpp +++ b/ldmicro/undoredo.cpp @@ -29,8 +29,6 @@ #include "ldmicro.h" -using namespace std; - // Store a `deep copy' of the entire program before every change, in a // circular buffer so that the first one scrolls out as soon as the buffer // is full and we try to push another one. |