summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRr422018-06-22 20:48:05 +0530
committerRr422018-06-22 20:48:05 +0530
commit7c5b6c7b6750b1af91225a214fb1af3c053ec3fe (patch)
treef7238dcada25d9f3236f269c8dc0a0e978829286
parent21af660f0da7cddd80033d1e4590468f618bb5ab (diff)
downloadLDMicroGtk-7c5b6c7b6750b1af91225a214fb1af3c053ec3fe.tar.gz
LDMicroGtk-7c5b6c7b6750b1af91225a214fb1af3c053ec3fe.tar.bz2
LDMicroGtk-7c5b6c7b6750b1af91225a214fb1af3c053ec3fe.zip
fixed bug where menu shortcuts without modifiers did not work
-rw-r--r--ldmicro/ldmicro.cpp13
-rw-r--r--ldmicro/lib/linuxUI/linuxUI.cpp1
-rw-r--r--ldmicro/maincontrols.cpp62
3 files changed, 39 insertions, 37 deletions
diff --git a/ldmicro/ldmicro.cpp b/ldmicro/ldmicro.cpp
index 5de3360..8edced8 100644
--- a/ldmicro/ldmicro.cpp
+++ b/ldmicro/ldmicro.cpp
@@ -1114,6 +1114,8 @@ gboolean LD_WM_Paint_call(HWID widget, HCRDC cr, gpointer data)//(HWID widget, G
gint width = gtk_widget_get_allocated_width (widget);
gint height = gtk_widget_get_allocated_height (widget);
+ gtk_widget_set_size_request(widget, width, height+1);
+
gdk_cairo_set_source_rgba (cr, (HBRUSH)GetStockObject(BLACK_BRUSH));
cairo_rectangle(cr, 0, 0, width, height);
@@ -1545,11 +1547,10 @@ int main(int argc, char** argv)
MakeMainWindowControls(); /// takes care of MakeMainWindowMenus()
MainWindowResized();
- // CHANGING_PROGRAM(ShowConfDialog());
/// Keyboard and mouse hooks equivalent to MainWndProc
g_signal_connect (MainWindow, "delete_event", G_CALLBACK (LD_WM_Close_call), NULL);
- g_signal_connect (MainWindow, "key_press_event", G_CALLBACK (LD_WM_KeyDown_call), NULL);
+ // g_signal_connect (MainWindow, "key_press_event", G_CALLBACK (LD_WM_KeyDown_call), NULL);
g_signal_connect (MainWindow, "button_press_event", G_CALLBACK (LD_GTK_mouse_click_hook), NULL);
g_signal_connect (MainWindow, "scroll_event", G_CALLBACK (LD_GTK_mouse_scroll_hook), NULL);
g_signal_connect (MainWindow, "motion_notify_event", G_CALLBACK (LD_WM_MouseMove_call), NULL);
@@ -1557,7 +1558,7 @@ int main(int argc, char** argv)
g_signal_connect (MainWindow, "destroy_event", G_CALLBACK (LD_WM_Destroy_call), NULL);
g_signal_connect (MainWindow, "configure_event", G_CALLBACK (LD_WM_Size_call), NULL);
g_signal_connect (MainWindow, "configure_event", G_CALLBACK (LD_WM_Size_call), NULL);
- // g_signal_connect (MainWindow, "focus_in_event", G_CALLBACK (LD_WM_SetFocus_call), NULL);
+ g_signal_connect (MainWindow, "focus_in_event", G_CALLBACK (LD_WM_SetFocus_call), NULL);
MenuHandler();
/// Keyboard and mouse hooks equivalent to MainWndProc - end
@@ -1593,9 +1594,9 @@ int main(int argc, char** argv)
UndoFlush();
}
- GenerateIoListDontLoseSelection(); //~
- // RefreshScrollbars();
- UpdateMainWindowTitleBar(); //~
+ GenerateIoListDontLoseSelection();
+ RefreshScrollbars();
+ UpdateMainWindowTitleBar();
// MSG msg;
// DWORD ret;
diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp
index 9891d70..f5029b9 100644
--- a/ldmicro/lib/linuxUI/linuxUI.cpp
+++ b/ldmicro/lib/linuxUI/linuxUI.cpp
@@ -396,6 +396,7 @@ void TextOut(HWID hWid, HCRDC hcr, int nXStart, int nYStart, LPCTSTR lpString, i
if (resize_flag)
gtk_widget_set_size_request(hWid, width, height);
+
char* text = (char*)malloc(cchString);
strncpy(text, lpString, cchString);
text[cchString] = '\0';
diff --git a/ldmicro/maincontrols.cpp b/ldmicro/maincontrols.cpp
index b3f8a33..e964aa1 100644
--- a/ldmicro/maincontrols.cpp
+++ b/ldmicro/maincontrols.cpp
@@ -166,65 +166,65 @@ void AddMenuAccelerators (void){
gtk_widget_add_accelerator (PushRungDownMenu, "activate", AccelGroup, GDK_KEY_downarrow,
GDK_SHIFT_MASK, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (DeleteElementMenu, "activate", AccelGroup, GDK_KEY_Delete,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (DeleteRungMenu, "activate", AccelGroup, GDK_KEY_Delete,
GDK_SHIFT_MASK, GTK_ACCEL_VISIBLE);
// Creating keyboard shortcuts for Instructions menu
gtk_widget_add_accelerator (InsertCommentMenu, "activate", AccelGroup, GDK_KEY_semicolon,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertContactsMenu, "activate", AccelGroup, GDK_KEY_C,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertOsrMenu, "activate", AccelGroup, GDK_KEY_backslash,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertOsfMenu, "activate", AccelGroup, GDK_KEY_slash,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertTonMenu, "activate", AccelGroup, GDK_KEY_O,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertTofMenu, "activate", AccelGroup, GDK_KEY_F,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertRtoMenu, "activate", AccelGroup, GDK_KEY_T,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertCtuMenu, "activate", AccelGroup, GDK_KEY_U,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertCtdMenu, "activate", AccelGroup, GDK_KEY_I,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertCtcMenu, "activate", AccelGroup, GDK_KEY_J,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertEquMenu, "activate", AccelGroup, GDK_KEY_equal,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertGrtMenu, "activate", AccelGroup, GDK_KEY_greater,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertGeqMenu, "activate", AccelGroup, GDK_KEY_Stop,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertLesMenu, "activate", AccelGroup, GDK_KEY_less,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertLeqMenu, "activate", AccelGroup, GDK_KEY_comma,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertCoilMenu, "activate", AccelGroup, GDK_KEY_L,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertResMenu, "activate", AccelGroup, GDK_KEY_E,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertMovMenu, "activate", AccelGroup, GDK_KEY_M,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertAddMenu, "activate", AccelGroup, GDK_KEY_plus,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertSubMenu, "activate", AccelGroup, GDK_KEY_minus,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertMulMenu, "activate", AccelGroup, GDK_KEY_multiply,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertDivMenu, "activate", AccelGroup, GDK_KEY_D,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (InsertReadAdcMenu, "activate", AccelGroup, GDK_KEY_P,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (MakeNormalMenu, "activate", AccelGroup, GDK_KEY_A,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (NegateMenu, "activate", AccelGroup, GDK_KEY_N,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (MakeSetOnlyMenu, "activate", AccelGroup, GDK_KEY_S,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (MakeResetOnlyMenu, "activate", AccelGroup, GDK_KEY_R,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
// Creating keyboard shortcuts for Simulation menu
gtk_widget_add_accelerator (SimulationModeMenu, "activate", AccelGroup, GDK_KEY_M,
@@ -234,15 +234,15 @@ void AddMenuAccelerators (void){
gtk_widget_add_accelerator (StopSimulationMenu, "activate", AccelGroup, GDK_KEY_H,
GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (SingleCycleMenu, "activate", AccelGroup, GDK_KEY_space,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
// Creating keyboard shortcuts for Compile menu
gtk_widget_add_accelerator (CompileMenu, "activate", AccelGroup, GDK_KEY_F5,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
// Creating keyboard shortcuts for Help menu
gtk_widget_add_accelerator (ManualMenu, "activate", AccelGroup, GDK_KEY_F1,
- GDK_RELEASE_MASK, GTK_ACCEL_VISIBLE);
+ (GdkModifierType)0, GTK_ACCEL_VISIBLE);
gtk_window_add_accel_group (GTK_WINDOW (MainWindow), AccelGroup);