* Leonardo Zide <[email protected]> [2011-08-31 16:18]:
>   You can post here if you want, or send them directly to me.

OK, here they are. Feel free to give any remark about them, I can
rewrite them if needed.

>   The KeyboardShortcuts system was added to let people customize their
> shortcuts so if they want they could have their keys mapped similar to the
> original LDraw (or in any way they want). It just wasn't added to the Linux
> port because I think there were some problems detecting keys that way, for
> example pressing Ctrl+C while typing in an edit control gets intercepted by
> the main window instead of allowing the control to copy and paste.

I will try to see if I can change this as shortcuts are really useful.

Nicolas.
>From 90cfb1cd97ca4391c4d79bc18ae5b3914ae1eb70 Mon Sep 17 00:00:00 2001
From: Nicolas Schodet <[email protected]>
Date: Wed, 31 Aug 2011 20:08:06 +0200
Subject: [PATCH 1/7] Ignore deprecated conversion from string constant warning.

---
 config.mk |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/config.mk b/config.mk
index d269b15..7818749 100644
--- a/config.mk
+++ b/config.mk
@@ -10,7 +10,7 @@ CC	:= gcc
 CXX	:= g++
 
 # (Add a -g for debugging)
-CPPFLAGS += -O2 -Wall
+CPPFLAGS += -O2 -Wall -Wno-write-strings
 
 # Add compile options, such as -I option to include jpeglib's headers
 # CPPFLAGS += -I/home/fred/jpeglib
-- 
1.7.2.5

>From 7eb719a4b7d2d2649e17a030b5bfd33d0aa58767 Mon Sep 17 00:00:00 2001
From: Nicolas Schodet <[email protected]>
Date: Wed, 31 Aug 2011 20:08:39 +0200
Subject: [PATCH 2/7] Fix "select none" menu entry.

---
 linux/system.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/linux/system.cpp b/linux/system.cpp
index cdf9921..acd6919 100644
--- a/linux/system.cpp
+++ b/linux/system.cpp
@@ -511,7 +511,7 @@ void SystemUpdateSelected(unsigned long flags, int SelectedCount, Object* Focus)
 
   gtk_widget_set_sensitive (item, (flags & LC_SEL_UNSELECTED) != 0);
   item = GTK_WIDGET (gtk_object_get_data (GTK_OBJECT (((GtkWidget*)(*main_window))), "menu_edit_select_none"));
-  gtk_widget_set_sensitive (item, flags & (LC_SEL_PIECE|LC_SEL_CAMERA|LC_SEL_LIGHT) != 0);
+  gtk_widget_set_sensitive (item, (flags & (LC_SEL_PIECE|LC_SEL_CAMERA|LC_SEL_LIGHT)) != 0);
   item = GTK_WIDGET (gtk_object_get_data (GTK_OBJECT (((GtkWidget*)(*main_window))), "menu_edit_select_invert"));
   gtk_widget_set_sensitive (item, (flags & LC_SEL_NO_PIECES) == 0);
   item = GTK_WIDGET (gtk_object_get_data (GTK_OBJECT (((GtkWidget*)(*main_window))), "menu_edit_select_byname"));
-- 
1.7.2.5

>From 415f3c089b112a8debdba834ecb76c9c051279da Mon Sep 17 00:00:00 2001
From: Nicolas Schodet <[email protected]>
Date: Wed, 31 Aug 2011 20:09:31 +0200
Subject: [PATCH 3/7] Fix snap settings display.

---
 linux/system.cpp |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/linux/system.cpp b/linux/system.cpp
index acd6919..b4f726e 100644
--- a/linux/system.cpp
+++ b/linux/system.cpp
@@ -15,6 +15,7 @@
 #include "toolbar.h"
 #include "dialogs.h"
 #include "globals.h"
+#include "lc_application.h"
 
 // =============================================================================
 // Cursor functions
@@ -487,16 +488,16 @@ void SystemUpdateAnimation(bool bAnimation, bool bAddKeys)
 
 void SystemUpdateSnap(unsigned short move_snap, unsigned short RotateSnap)
 {
-  if (!label_snap)
-    return;
+	if (!label_snap)
+		return;
 
-  char text[11];
-  if (move_snap)
-    sprintf (text, "Move x%i", move_snap);
-  else
-    strcpy (text, "Move /2");
+	char Text[256], xy[32], z[32];
+
+	lcGetActiveProject()->GetSnapDistanceText(xy, z);
+
+	sprintf(Text, " M: %s %s R: %d ", xy, z, RotateSnap);
 
-  gtk_label_set (GTK_LABEL (label_snap), text);
+	gtk_label_set (GTK_LABEL (label_snap), Text);
 }
 
 void SystemUpdateSelected(unsigned long flags, int SelectedCount, Object* Focus)
-- 
1.7.2.5

>From 078a0031b9e0bb840de6babc5ebec62450f48919 Mon Sep 17 00:00:00 2001
From: Nicolas Schodet <[email protected]>
Date: Wed, 31 Aug 2011 20:37:07 +0200
Subject: [PATCH 4/7] Update interface at startup.

---
 linux/main.cpp |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/linux/main.cpp b/linux/main.cpp
index 7720d92..c0c8a74 100644
--- a/linux/main.cpp
+++ b/linux/main.cpp
@@ -659,6 +659,7 @@ int main (int argc, char* argv[])
 
 #include "pixmaps/icon32.xpm"
 
+	lcGetActiveProject()->UpdateInterface();
   main_window->UpdateMRU ();
 
   GdkPixmap *gdkpixmap;
-- 
1.7.2.5

>From b909c328b7e292736e9e05e64634cc01605a2a6d Mon Sep 17 00:00:00 2001
From: Nicolas Schodet <[email protected]>
Date: Wed, 31 Aug 2011 20:37:40 +0200
Subject: [PATCH 5/7] Do not force statusbar item size.

---
 linux/toolbar.cpp |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/linux/toolbar.cpp b/linux/toolbar.cpp
index 431fffb..357c003 100644
--- a/linux/toolbar.cpp
+++ b/linux/toolbar.cpp
@@ -827,7 +827,6 @@ void create_statusbar(GtkWidget *window, GtkWidget *vbox)
 
   hbox = gtk_hbox_new (FALSE, 0);
   gtk_widget_show (hbox);
-  gtk_widget_set_usize (hbox, -1, 24);
   gtk_container_border_width (GTK_CONTAINER (hbox), 1);
   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 2);
 
@@ -851,7 +850,6 @@ void create_statusbar(GtkWidget *window, GtkWidget *vbox)
   gtk_widget_show (frame);
   gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, TRUE, 0);
   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
-  gtk_widget_set_usize (frame, 150, -1);
 
   hbox1 = gtk_hbox_new (FALSE, 0);
   gtk_container_add (GTK_CONTAINER (frame), hbox1);
@@ -866,7 +864,6 @@ void create_statusbar(GtkWidget *window, GtkWidget *vbox)
   gtk_widget_show (frame);
   gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, TRUE, 0);
   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
-  gtk_widget_set_usize (frame, 70, -1);
 
   hbox1 = gtk_hbox_new (FALSE, 0);
   gtk_container_add (GTK_CONTAINER (frame), hbox1);
@@ -881,7 +878,6 @@ void create_statusbar(GtkWidget *window, GtkWidget *vbox)
   gtk_widget_show (frame);
   gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, TRUE, 0);
   gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
-  gtk_widget_set_usize (frame, 70, -1);
 
   hbox1 = gtk_hbox_new (FALSE, 0);
   gtk_container_add (GTK_CONTAINER (frame), hbox1);
-- 
1.7.2.5

>From 02d8936922cfb55a1aa0fd9bebf002200fcc5ad1 Mon Sep 17 00:00:00 2001
From: Nicolas Schodet <[email protected]>
Date: Wed, 31 Aug 2011 22:22:24 +0200
Subject: [PATCH 6/7] Remove toolbar borders.

---
 linux/toolbar.cpp |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/linux/toolbar.cpp b/linux/toolbar.cpp
index 357c003..bc78139 100644
--- a/linux/toolbar.cpp
+++ b/linux/toolbar.cpp
@@ -89,7 +89,6 @@ void create_toolbars(GtkWidget *window, GtkWidget *vbox)
   gtk_container_add (GTK_CONTAINER (main_toolbar.handle_box), main_toolbar.toolbar);
   gtk_widget_show (main_toolbar.toolbar);
 
-  gtk_container_border_width (GTK_CONTAINER (main_toolbar.toolbar), 2);
   //  gtk_toolbar_set_button_relief (GTK_TOOLBAR (main_toolbar.toolbar), GTK_RELIEF_NONE);
   //  gtk_toolbar_set_space_style (GTK_TOOLBAR (main_toolbar.toolbar), GTK_TOOLBAR_SPACE_LINE);
   //  gtk_toolbar_set_space_size (GTK_TOOLBAR (main_toolbar.toolbar), 10);
@@ -151,7 +150,6 @@ void create_toolbars(GtkWidget *window, GtkWidget *vbox)
   gtk_container_add (GTK_CONTAINER (tool_toolbar.handle_box), tool_toolbar.toolbar);
   gtk_widget_show (tool_toolbar.toolbar);
 
-  gtk_container_border_width (GTK_CONTAINER (tool_toolbar.toolbar), 2);
   //  gtk_toolbar_set_button_relief (GTK_TOOLBAR (tool_toolbar.toolbar), GTK_RELIEF_NONE);
 
   tool_toolbar.brick = button = gtk_toolbar_append_element (GTK_TOOLBAR (tool_toolbar.toolbar), 
@@ -216,7 +214,6 @@ void create_toolbars(GtkWidget *window, GtkWidget *vbox)
   gtk_container_add (GTK_CONTAINER (anim_toolbar.handle_box), anim_toolbar.toolbar);
   gtk_widget_show (anim_toolbar.toolbar);
 
-  gtk_container_border_width (GTK_CONTAINER (anim_toolbar.toolbar), 2);
   //  gtk_toolbar_set_button_relief (GTK_TOOLBAR (anim_toolbar.toolbar), GTK_RELIEF_NONE);
 
   anim_toolbar.first = gtk_toolbar_append_item (GTK_TOOLBAR (anim_toolbar.toolbar),
-- 
1.7.2.5

>From 534224a85f773bc941ef8c83dc0126a0283216fd Mon Sep 17 00:00:00 2001
From: Nicolas Schodet <[email protected]>
Date: Thu, 1 Sep 2011 00:12:39 +0200
Subject: [PATCH 7/7] Added snap move menu.

---
 linux/toolbar.cpp |   86 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 84 insertions(+), 2 deletions(-)

diff --git a/linux/toolbar.cpp b/linux/toolbar.cpp
index bc78139..3854c3f 100644
--- a/linux/toolbar.cpp
+++ b/linux/toolbar.cpp
@@ -15,6 +15,7 @@
 #include "preview.h"
 #include "library.h"
 #include "lc_application.h"
+#include "gtkmisc.h"
 
 // =============================================================================
 // Variables
@@ -818,9 +819,32 @@ static void statusbar_listener (int message, void *data, void *user)
   }
 }
 
+static gint statusbar_popup(GtkWidget *widget, GdkEvent *event,
+                            GtkWidget *menu_widget)
+{
+	GtkMenu *menu;
+	GdkEventButton *event_button;
+	g_return_val_if_fail(widget != NULL, FALSE);
+	g_return_val_if_fail(event != NULL, FALSE);
+	g_return_val_if_fail(menu_widget != NULL, FALSE);
+	g_return_val_if_fail(GTK_IS_MENU(menu_widget), FALSE);
+	menu = GTK_MENU(menu_widget);
+	if (event->type == GDK_BUTTON_PRESS)
+	{
+		event_button = (GdkEventButton *) event;
+		if (event_button->button == 3)
+		{
+			gtk_menu_popup(menu, NULL, NULL, NULL, NULL,
+			               event_button->button, event_button->time);
+			return TRUE;
+		}
+	}
+	return FALSE;
+}
+
 void create_statusbar(GtkWidget *window, GtkWidget *vbox)
 {
-  GtkWidget *hbox, *hbox1, *frame;
+  GtkWidget *hbox, *hbox1, *frame, *ebox_snap;
 
   hbox = gtk_hbox_new (FALSE, 0);
   gtk_widget_show (hbox);
@@ -867,9 +891,13 @@ void create_statusbar(GtkWidget *window, GtkWidget *vbox)
   gtk_container_border_width (GTK_CONTAINER (hbox1), 0);
   gtk_widget_show (hbox1);
 
+	ebox_snap = gtk_event_box_new();
+	gtk_widget_show(ebox_snap);
+	gtk_box_pack_start(GTK_BOX(hbox1), ebox_snap, TRUE, TRUE, 0);
+
   label_snap = gtk_label_new (" ");
   gtk_widget_show (label_snap);
-  gtk_box_pack_start (GTK_BOX (hbox1), label_snap, TRUE, TRUE, 0);
+	gtk_container_add(GTK_CONTAINER(ebox_snap), label_snap);
 
   frame = gtk_frame_new (NULL);
   gtk_widget_show (frame);
@@ -886,4 +914,58 @@ void create_statusbar(GtkWidget *window, GtkWidget *vbox)
   gtk_box_pack_start (GTK_BOX (hbox1), label_step, TRUE, TRUE, 0);
 
   messenger->Listen (&statusbar_listener, NULL);
+
+	// Add snap popup menu
+	GtkWidget *menu, *item;
+	menu = gtk_menu_new();
+	item = gtk_menu_item_new_with_label("XY Snap");
+	gtk_widget_set_sensitive(item, FALSE);
+	gtk_menu_append(menu, item);
+	create_menu_item(menu, "None", NULL, GTK_SIGNAL_FUNC(OnCommandDirect),
+	                 NULL, LC_EDIT_MOVEXY_SNAP_0, NULL);
+	create_menu_item(menu, "1/20 Stud", NULL, GTK_SIGNAL_FUNC(OnCommandDirect),
+	                 NULL, LC_EDIT_MOVEXY_SNAP_1, NULL);
+	create_menu_item(menu, "1/4 Stud", NULL, GTK_SIGNAL_FUNC(OnCommandDirect),
+	                 NULL, LC_EDIT_MOVEXY_SNAP_2, NULL);
+	create_menu_item(menu, "1 Flat", NULL, GTK_SIGNAL_FUNC(OnCommandDirect),
+	                 NULL, LC_EDIT_MOVEXY_SNAP_3, NULL);
+	create_menu_item(menu, "1/2 Stud", NULL, GTK_SIGNAL_FUNC(OnCommandDirect),
+	                 NULL, LC_EDIT_MOVEXY_SNAP_4, NULL);
+	create_menu_item(menu, "1 Stud", NULL, GTK_SIGNAL_FUNC(OnCommandDirect),
+	                 NULL, LC_EDIT_MOVEXY_SNAP_5, NULL);
+	create_menu_item(menu, "2 Studs", NULL, GTK_SIGNAL_FUNC(OnCommandDirect),
+	                 NULL, LC_EDIT_MOVEXY_SNAP_6, NULL);
+	create_menu_item(menu, "3 Studs", NULL, GTK_SIGNAL_FUNC(OnCommandDirect),
+	                 NULL, LC_EDIT_MOVEXY_SNAP_7, NULL);
+	create_menu_item(menu, "4 Studs", NULL, GTK_SIGNAL_FUNC(OnCommandDirect),
+	                 NULL, LC_EDIT_MOVEXY_SNAP_8, NULL);
+	create_menu_item(menu, "8 Studs", NULL, GTK_SIGNAL_FUNC(OnCommandDirect),
+	                 NULL, LC_EDIT_MOVEXY_SNAP_9, NULL);
+	menu_separator(menu);
+	item = gtk_menu_item_new_with_label("Z Snap");
+	gtk_widget_set_sensitive(item, FALSE);
+	gtk_menu_append(menu, item);
+	create_menu_item(menu, "None", NULL, GTK_SIGNAL_FUNC(OnCommandDirect),
+	                 NULL, LC_EDIT_MOVEZ_SNAP_0, NULL);
+	create_menu_item(menu, "1/20 Stud", NULL, GTK_SIGNAL_FUNC(OnCommandDirect),
+	                 NULL, LC_EDIT_MOVEZ_SNAP_1, NULL);
+	create_menu_item(menu, "1/4 Stud", NULL, GTK_SIGNAL_FUNC(OnCommandDirect),
+	                 NULL, LC_EDIT_MOVEZ_SNAP_2, NULL);
+	create_menu_item(menu, "1 Flat", NULL, GTK_SIGNAL_FUNC(OnCommandDirect),
+	                 NULL, LC_EDIT_MOVEZ_SNAP_3, NULL);
+	create_menu_item(menu, "1/2 Stud", NULL, GTK_SIGNAL_FUNC(OnCommandDirect),
+	                 NULL, LC_EDIT_MOVEZ_SNAP_4, NULL);
+	create_menu_item(menu, "1 Stud", NULL, GTK_SIGNAL_FUNC(OnCommandDirect),
+	                 NULL, LC_EDIT_MOVEZ_SNAP_5, NULL);
+	create_menu_item(menu, "1 Brick", NULL, GTK_SIGNAL_FUNC(OnCommandDirect),
+	                 NULL, LC_EDIT_MOVEZ_SNAP_6, NULL);
+	create_menu_item(menu, "2 Bricks", NULL, GTK_SIGNAL_FUNC(OnCommandDirect),
+	                 NULL, LC_EDIT_MOVEZ_SNAP_7, NULL);
+	create_menu_item(menu, "4 Bricks", NULL, GTK_SIGNAL_FUNC(OnCommandDirect),
+	                 NULL, LC_EDIT_MOVEZ_SNAP_8, NULL);
+	create_menu_item(menu, "8 Bricks", NULL, GTK_SIGNAL_FUNC(OnCommandDirect),
+	                 NULL, LC_EDIT_MOVEZ_SNAP_9, NULL);
+	gtk_widget_show_all(menu);
+	gtk_signal_connect(GTK_OBJECT(ebox_snap), "button_press_event",
+	                   GTK_SIGNAL_FUNC(statusbar_popup), menu);
 }
-- 
1.7.2.5

_______________________________________________
Leocad mailing list
[email protected]
https://list.gerf.org/listinfo/leocad

Reply via email to