summaryrefslogtreecommitdiff
path: root/ldmicro
diff options
context:
space:
mode:
Diffstat (limited to 'ldmicro')
-rw-r--r--ldmicro/includes/ldmicro.h8
-rw-r--r--ldmicro/lib/linuxUI/linuxUI.cpp45
-rw-r--r--ldmicro/maincontrols.cpp453
3 files changed, 233 insertions, 273 deletions
diff --git a/ldmicro/includes/ldmicro.h b/ldmicro/includes/ldmicro.h
index 50299ee..df8c02e 100644
--- a/ldmicro/includes/ldmicro.h
+++ b/ldmicro/includes/ldmicro.h
@@ -515,9 +515,9 @@ void RefreshScrollbars(void);
extern HINSTANCE Instance;
extern HWND MainWindow;
extern HDC Hdc;
-extern PlcProgram Prog;
+extern PlcProgram Prog;*/
extern char CurrentSaveFile[MAX_PATH];
-extern char CurrentCompileFile[MAX_PATH];
+/*extern char CurrentCompileFile[MAX_PATH];
extern McuIoInfo SupportedMcus[NUM_SUPPORTED_MCUS];
// memory debugging, because I often get careless; ok() will check that the
// heap used for all the program storage is not yet corrupt, and oops() if
@@ -746,9 +746,9 @@ void SimulationResetContact(char* name);
void SetAdcShadow(char *name, SWORD val);
SWORD GetAdcShadow(char *name);
void DestroyUartSimulationWindow(void);
-void ShowUartSimulationWindow(void);
+void ShowUartSimulationWindow(void);*/
extern BOOL InSimulationMode;
-extern BOOL SimulateRedrawAfterNextCycle;
+/*extern BOOL SimulateRedrawAfterNextCycle;
// compilecommon.cpp
void AllocStart(void);
diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp
index 8904f77..3dbe1bb 100644
--- a/ldmicro/lib/linuxUI/linuxUI.cpp
+++ b/ldmicro/lib/linuxUI/linuxUI.cpp
@@ -1,49 +1,8 @@
#include "linuxUI.h"
/// Menu Variables
-HWID window;
-HWID menu_box; // Box for alignment
-HWID packed_menu_box; // Stores the packed box
-HWID FileMenu; // File Menu
-HWID EditMenu; // Edit Menu
-HWID settings; // Settings Menu
-HWID ProcessorMenu; // Processor Menu
-HWID InstructionMenu; // Instruction Menu
-HWID compile; // Compile Menu
-HWID help; // Help Menu
-HWID SimulateMenu; // Simulate Menu
-HWID menu_bar; // Menu Bar
-HWID file_label; // File menu label
-HWID edit_label; // Edit menu label
-HWID instruction_label; // Instruction menu label
-HWID settings_label; // Settings menu label
-HWID compile_label; // Compile menu label
-HWID help_label; // Help menu label
-HWID simulate_label; // Simulate menu label
-HWID file_menu_items; // File menu item
-HWID edit_menu_items; // Edit menu item
-HWID instruction_menu_items; // Instruction menu item
-HWID settings_menu_items; // Settings menu item
-HWID processor_menu_items; // Processor menu items
-HWID compile_menu_items; // Compile menu item
-HWID help_menu_items; // Help menu item
-HWID simulate_menu_items; // Simulate menu item
-HWID file_menu_separator; // File menu separator
-HWID edit_menu_separator; // Edit menu separator
-HWID instruction_menu_separator; // Instruction menu separator
-HWID simulate_menu_separator; // Simulate menu separator
-
-//Scrollbars for the ladder logic area
-int ScrollWidth; // Width of scrolling
-int ScrollHeight; // Height of scrolling
-HWID IoList; // Window for list view
-
-// ldmicro.cpp
-char CurrentSaveFile[MAX_PATH];
-
-// Simulation Mode
-BOOL InSimulationMode;
-
+ HWID window;
+
/// Wraper function for gtk_window_has_toplevel_focus
BOOL isFocus(HWID window)
{
diff --git a/ldmicro/maincontrols.cpp b/ldmicro/maincontrols.cpp
index 7fc708c..ba17369 100644
--- a/ldmicro/maincontrols.cpp
+++ b/ldmicro/maincontrols.cpp
@@ -222,233 +222,234 @@ void SetUndoEnabled(BOOL undoEnabled, BOOL redoEnabled)
HMENU MakeMainWindowMenus(void)
{
- int i;
- // Creating a box for desired orientation
- menu_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
-
- // Create new menu bar to hold menu and add it to window
- menu_bar = gtk_menu_bar_new();
-
- // Creating various menus
- FileMenu = gtk_menu_new();
- file_label = gtk_menu_item_new_with_label("File");
- EditMenu = gtk_menu_new();
- edit_label = gtk_menu_item_new_with_label("Edit");
- settings = gtk_menu_new();
- settings_label = gtk_menu_item_new_with_label("Settings");
- ProcessorMenu = gtk_menu_new();
- InstructionMenu = gtk_menu_new();
- instruction_label = gtk_menu_item_new_with_label("Instructions");
- SimulateMenu = gtk_menu_new();
- simulate_label = gtk_menu_item_new_with_label("Simulate");
- compile = gtk_menu_new();
- compile_label = gtk_menu_item_new_with_label("Compile");
- help = gtk_menu_new();
- help_label = gtk_menu_item_new_with_label("Help");
-
- // Appending menu items to File menu
- file_menu_items = gtk_menu_item_new_with_label("New"); // Create a new menu item with a name
- gtk_menu_shell_append(GTK_MENU_SHELL (FileMenu), file_menu_items); // Appending menu items
- file_menu_items = gtk_menu_item_new_with_label("Open");
- gtk_menu_shell_append(GTK_MENU_SHELL (FileMenu), file_menu_items);
- file_menu_items = gtk_menu_item_new_with_label("Save");
- gtk_menu_shell_append(GTK_MENU_SHELL (FileMenu), file_menu_items);
- file_menu_items = gtk_menu_item_new_with_label("Save As");
- gtk_menu_shell_append(GTK_MENU_SHELL (FileMenu), file_menu_items);
- file_menu_separator = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(FileMenu), file_menu_separator);
- file_menu_items = gtk_menu_item_new_with_label("Export As Text");
- gtk_menu_shell_append(GTK_MENU_SHELL (FileMenu), file_menu_items);
- file_menu_separator = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(FileMenu), file_menu_separator);
- file_menu_items = gtk_menu_item_new_with_label("Exit");
- gtk_menu_shell_append(GTK_MENU_SHELL (FileMenu), file_menu_items);
-
- // Appending menu items to Edit menu
- edit_menu_items = gtk_menu_item_new_with_label("Undo");
- gtk_menu_shell_append(GTK_MENU_SHELL (EditMenu), edit_menu_items);
- edit_menu_items = gtk_menu_item_new_with_label("Redo");
- gtk_menu_shell_append(GTK_MENU_SHELL (EditMenu), edit_menu_items);
- edit_menu_separator = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(EditMenu), edit_menu_separator);
- edit_menu_items = gtk_menu_item_new_with_label("Insert rung Before");
- gtk_menu_shell_append(GTK_MENU_SHELL (EditMenu), edit_menu_items);
- edit_menu_items = gtk_menu_item_new_with_label("Insert Rung After");
- gtk_menu_shell_append(GTK_MENU_SHELL (EditMenu), edit_menu_items);
- edit_menu_items = gtk_menu_item_new_with_label("Move Selected Rung Up");
- gtk_menu_shell_append(GTK_MENU_SHELL (EditMenu), edit_menu_items);
- edit_menu_items = gtk_menu_item_new_with_label("Move Selected Rung Down");
- gtk_menu_shell_append(GTK_MENU_SHELL (EditMenu), edit_menu_items);
- edit_menu_separator = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(EditMenu), edit_menu_separator);
- edit_menu_items = gtk_menu_item_new_with_label("Delete Selected Element");
- gtk_menu_shell_append(GTK_MENU_SHELL (EditMenu), edit_menu_items);
- edit_menu_items = gtk_menu_item_new_with_label("Delete Rung");
- gtk_menu_shell_append(GTK_MENU_SHELL (EditMenu), edit_menu_items);
-
- // Appending menu items to Settings menu
- settings_menu_items = gtk_menu_item_new_with_label ("MCU Parameters...");
- gtk_menu_shell_append (GTK_MENU_SHELL (settings), settings_menu_items);
- settings_menu_items = gtk_menu_item_new_with_label ("Microcontroller");
- gtk_menu_shell_append (GTK_MENU_SHELL (settings), settings_menu_items);
- for (i = 0; i < NUM_SUPPORTED_MCUS; i++){
- processor_menu_items = gtk_menu_item_new_with_label (SupportedMcus[i].mcuName);
+ HMENU settings, compile, help;
+ int i;
+ // Creating a box for desired orientation
+ menu_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+
+ // Create new menu bar to hold menu and add it to window
+ menu_bar = gtk_menu_bar_new();
+
+ // Creating various menus
+ FileMenu = gtk_menu_new();
+ file_label = gtk_menu_item_new_with_label("File");
+ EditMenu = gtk_menu_new();
+ edit_label = gtk_menu_item_new_with_label("Edit");
+ settings = gtk_menu_new();
+ settings_label = gtk_menu_item_new_with_label("Settings");
+ ProcessorMenu = gtk_menu_new();
+ InstructionMenu = gtk_menu_new();
+ instruction_label = gtk_menu_item_new_with_label("Instructions");
+ SimulateMenu = gtk_menu_new();
+ simulate_label = gtk_menu_item_new_with_label("Simulate");
+ compile = gtk_menu_new();
+ compile_label = gtk_menu_item_new_with_label("Compile");
+ help = gtk_menu_new();
+ help_label = gtk_menu_item_new_with_label("Help");
+
+ // Appending menu items to File menu
+ file_menu_items = gtk_menu_item_new_with_label("New"); // Create a new menu item with a name
+ gtk_menu_shell_append(GTK_MENU_SHELL (FileMenu), file_menu_items); // Appending menu items
+ file_menu_items = gtk_menu_item_new_with_label("Open");
+ gtk_menu_shell_append(GTK_MENU_SHELL (FileMenu), file_menu_items);
+ file_menu_items = gtk_menu_item_new_with_label("Save");
+ gtk_menu_shell_append(GTK_MENU_SHELL (FileMenu), file_menu_items);
+ file_menu_items = gtk_menu_item_new_with_label("Save As");
+ gtk_menu_shell_append(GTK_MENU_SHELL (FileMenu), file_menu_items);
+ file_menu_separator = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(FileMenu), file_menu_separator);
+ file_menu_items = gtk_menu_item_new_with_label("Export As Text");
+ gtk_menu_shell_append(GTK_MENU_SHELL (FileMenu), file_menu_items);
+ file_menu_separator = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(FileMenu), file_menu_separator);
+ file_menu_items = gtk_menu_item_new_with_label("Exit");
+ gtk_menu_shell_append(GTK_MENU_SHELL (FileMenu), file_menu_items);
+
+ // Appending menu items to Edit menu
+ edit_menu_items = gtk_menu_item_new_with_label("Undo");
+ gtk_menu_shell_append(GTK_MENU_SHELL (EditMenu), edit_menu_items);
+ edit_menu_items = gtk_menu_item_new_with_label("Redo");
+ gtk_menu_shell_append(GTK_MENU_SHELL (EditMenu), edit_menu_items);
+ edit_menu_separator = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(EditMenu), edit_menu_separator);
+ edit_menu_items = gtk_menu_item_new_with_label("Insert rung Before");
+ gtk_menu_shell_append(GTK_MENU_SHELL (EditMenu), edit_menu_items);
+ edit_menu_items = gtk_menu_item_new_with_label("Insert Rung After");
+ gtk_menu_shell_append(GTK_MENU_SHELL (EditMenu), edit_menu_items);
+ edit_menu_items = gtk_menu_item_new_with_label("Move Selected Rung Up");
+ gtk_menu_shell_append(GTK_MENU_SHELL (EditMenu), edit_menu_items);
+ edit_menu_items = gtk_menu_item_new_with_label("Move Selected Rung Down");
+ gtk_menu_shell_append(GTK_MENU_SHELL (EditMenu), edit_menu_items);
+ edit_menu_separator = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(EditMenu), edit_menu_separator);
+ edit_menu_items = gtk_menu_item_new_with_label("Delete Selected Element");
+ gtk_menu_shell_append(GTK_MENU_SHELL (EditMenu), edit_menu_items);
+ edit_menu_items = gtk_menu_item_new_with_label("Delete Rung");
+ gtk_menu_shell_append(GTK_MENU_SHELL (EditMenu), edit_menu_items);
+
+ // Appending menu items to Settings menu
+ settings_menu_items = gtk_menu_item_new_with_label ("MCU Parameters...");
+ gtk_menu_shell_append (GTK_MENU_SHELL (settings), settings_menu_items);
+ settings_menu_items = gtk_menu_item_new_with_label ("Microcontroller");
+ gtk_menu_shell_append (GTK_MENU_SHELL (settings), settings_menu_items);
+ for (i = 0; i < NUM_SUPPORTED_MCUS; i++){
+ processor_menu_items = gtk_menu_item_new_with_label (SupportedMcus[i].mcuName);
+ gtk_menu_shell_append (GTK_MENU_SHELL (ProcessorMenu), processor_menu_items);
+ }
+ processor_menu_items = gtk_menu_item_new_with_label ("(no microcontroller)");
gtk_menu_shell_append (GTK_MENU_SHELL (ProcessorMenu), processor_menu_items);
- }
- processor_menu_items = gtk_menu_item_new_with_label ("(no microcontroller)");
- gtk_menu_shell_append (GTK_MENU_SHELL (ProcessorMenu), processor_menu_items);
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(settings_menu_items), ProcessorMenu);
-
- // Appending menu items to Instruction menu
- instruction_menu_items = gtk_menu_item_new_with_label("Insert Comment");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_separator = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert Contacts");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_separator = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert OSR (One Shot Rising)");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert OSF (One Shot Falling)");
- instruction_menu_separator = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert TON (Delayed Turn On)");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert TOF (Delayed Turn Off)");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert RTO (Retentive Delayed Turn On)");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_separator = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert CTU (Count Up)");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert CTD (Count Down)");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert CTC (Count Circular)");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_separator = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert EQU (Compare for Equals)");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert NEQ (Compare for Not Equals)");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert GRT (Compare for Greater Than)");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert GEQ (Compare for Greater Than or Equal)");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert LES (Compare for Less Than)");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert LEQ (Compare for Less Than or Equal)");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_separator = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert Open Circuit");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert Short Circuit");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert Master Control Relay");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_separator = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert Coil");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert RES (Counter/RTO Reset)");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_separator = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert MOV (Move)");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert ADD (16-bit Integer Ad)");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert SUB (16-bit Integer Subtract)");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert MUL (16-bit Integer Multiply)");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert DIV (16-bit Integer Division)");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_separator = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert Shift Register");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert Look-Up Table");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert Piecewise Linear");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert Formatted String Over UART");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_separator = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert UART Send");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert UART Receive");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert Set PWM Output");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert A/D Converter Read");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Insert Make Persistent");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_separator = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
- instruction_menu_items = gtk_menu_item_new_with_label("Make Normal");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Make Negated");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Make Set-Only");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
- instruction_menu_items = gtk_menu_item_new_with_label("Make Reset-Only");
- gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
-
- // Appending menu items to Compile menu
- compile_menu_items = gtk_menu_item_new_with_label("Compile");
- gtk_menu_shell_append(GTK_MENU_SHELL (compile), compile_menu_items);
- compile_menu_items = gtk_menu_item_new_with_label("Compile As...");
- gtk_menu_shell_append(GTK_MENU_SHELL (compile), compile_menu_items);
-
- // Appending menu items to Help menu
- help_menu_items = gtk_menu_item_new_with_label("Manual...");
- gtk_menu_shell_append(GTK_MENU_SHELL (help), help_menu_items);
- help_menu_items = gtk_menu_item_new_with_label("About...");
- gtk_menu_shell_append(GTK_MENU_SHELL (help), help_menu_items);
-
- // Appending menu items to Simulate menu
- simulate_menu_items = gtk_menu_item_new_with_label("Simulation Mode");
- gtk_menu_shell_append(GTK_MENU_SHELL (SimulateMenu), simulate_menu_items);
- simulate_menu_items = gtk_menu_item_new_with_label("Start Real-Time Simulation");
- gtk_menu_shell_append(GTK_MENU_SHELL (SimulateMenu), simulate_menu_items);
- simulate_menu_items = gtk_menu_item_new_with_label("Halt Simulation");
- gtk_menu_shell_append(GTK_MENU_SHELL (SimulateMenu), simulate_menu_items);
- simulate_menu_items = gtk_menu_item_new_with_label("Single Cycle");
- gtk_menu_shell_append(GTK_MENU_SHELL (SimulateMenu), simulate_menu_items);
- simulate_menu_items = gtk_menu_item_new_with_label("Advanced Simulation");
- gtk_menu_shell_append(GTK_MENU_SHELL (SimulateMenu), simulate_menu_items);
- simulate_menu_separator = gtk_separator_menu_item_new();
- gtk_menu_shell_append(GTK_MENU_SHELL(SimulateMenu), simulate_menu_separator);
-
- // Creating submenus for each menu
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(file_label), FileMenu);
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(edit_label), EditMenu);
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(settings_label), settings);
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(instruction_label), InstructionMenu);
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(simulate_label), SimulateMenu);
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(compile_label), compile);
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(help_label), help);
-
- // Appending the menu item to the menu bar
- gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), file_label);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), edit_label);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), settings_label);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), instruction_label);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), simulate_label);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), compile_label);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), help_label);
-
- // Packing the menu bar into the box for alignment
- gtk_box_pack_start(GTK_BOX(menu_box), menu_bar, FALSE, FALSE, 0);
-
- return menu_box;
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(settings_menu_items), ProcessorMenu);
+
+ // Appending menu items to Instruction menu
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert Comment");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_separator = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert Contacts");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_separator = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert OSR (One Shot Rising)");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert OSF (One Shot Falling)");
+ instruction_menu_separator = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert TON (Delayed Turn On)");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert TOF (Delayed Turn Off)");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert RTO (Retentive Delayed Turn On)");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_separator = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert CTU (Count Up)");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert CTD (Count Down)");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert CTC (Count Circular)");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_separator = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert EQU (Compare for Equals)");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert NEQ (Compare for Not Equals)");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert GRT (Compare for Greater Than)");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert GEQ (Compare for Greater Than or Equal)");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert LES (Compare for Less Than)");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert LEQ (Compare for Less Than or Equal)");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_separator = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert Open Circuit");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert Short Circuit");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert Master Control Relay");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_separator = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert Coil");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert RES (Counter/RTO Reset)");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_separator = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert MOV (Move)");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert ADD (16-bit Integer Ad)");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert SUB (16-bit Integer Subtract)");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert MUL (16-bit Integer Multiply)");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert DIV (16-bit Integer Division)");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_separator = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert Shift Register");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert Look-Up Table");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert Piecewise Linear");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert Formatted String Over UART");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_separator = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert UART Send");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert UART Receive");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert Set PWM Output");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert A/D Converter Read");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Insert Make Persistent");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_separator = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(InstructionMenu), instruction_menu_separator);
+ instruction_menu_items = gtk_menu_item_new_with_label("Make Normal");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Make Negated");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Make Set-Only");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+ instruction_menu_items = gtk_menu_item_new_with_label("Make Reset-Only");
+ gtk_menu_shell_append (GTK_MENU_SHELL (InstructionMenu), instruction_menu_items);
+
+ // Appending menu items to Compile menu
+ compile_menu_items = gtk_menu_item_new_with_label("Compile");
+ gtk_menu_shell_append(GTK_MENU_SHELL (compile), compile_menu_items);
+ compile_menu_items = gtk_menu_item_new_with_label("Compile As...");
+ gtk_menu_shell_append(GTK_MENU_SHELL (compile), compile_menu_items);
+
+ // Appending menu items to Help menu
+ help_menu_items = gtk_menu_item_new_with_label("Manual...");
+ gtk_menu_shell_append(GTK_MENU_SHELL (help), help_menu_items);
+ help_menu_items = gtk_menu_item_new_with_label("About...");
+ gtk_menu_shell_append(GTK_MENU_SHELL (help), help_menu_items);
+
+ // Appending menu items to Simulate menu
+ simulate_menu_items = gtk_menu_item_new_with_label("Simulation Mode");
+ gtk_menu_shell_append(GTK_MENU_SHELL (SimulateMenu), simulate_menu_items);
+ simulate_menu_items = gtk_menu_item_new_with_label("Start Real-Time Simulation");
+ gtk_menu_shell_append(GTK_MENU_SHELL (SimulateMenu), simulate_menu_items);
+ simulate_menu_items = gtk_menu_item_new_with_label("Halt Simulation");
+ gtk_menu_shell_append(GTK_MENU_SHELL (SimulateMenu), simulate_menu_items);
+ simulate_menu_items = gtk_menu_item_new_with_label("Single Cycle");
+ gtk_menu_shell_append(GTK_MENU_SHELL (SimulateMenu), simulate_menu_items);
+ simulate_menu_items = gtk_menu_item_new_with_label("Advanced Simulation");
+ gtk_menu_shell_append(GTK_MENU_SHELL (SimulateMenu), simulate_menu_items);
+ simulate_menu_separator = gtk_separator_menu_item_new();
+ gtk_menu_shell_append(GTK_MENU_SHELL(SimulateMenu), simulate_menu_separator);
+
+ // Creating submenus for each menu
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(file_label), FileMenu);
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(edit_label), EditMenu);
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(settings_label), settings);
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(instruction_label), InstructionMenu);
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(simulate_label), SimulateMenu);
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(compile_label), compile);
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(help_label), help);
+
+ // Appending the menu item to the menu bar
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), file_label);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), edit_label);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), settings_label);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), instruction_label);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), simulate_label);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), compile_label);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), help_label);
+
+ // Packing the menu bar into the box for alignment
+ gtk_box_pack_start(GTK_BOX(menu_box), menu_bar, FALSE, FALSE, 0);
+
+ return menu_box;
}
//-----------------------------------------------------------------------------