delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2022/06/08/05:44:28

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
X-Original-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=psjt.org;
s=psjt01; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:
Date:Subject:To:From:Sender:Reply-To:Cc:Content-ID:Content-Description:
Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:
In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
List-Post:List-Owner:List-Archive;
bh=/hRXZi7zOfm0ZYXXJoddAEnLcS5YL3Mxa8VGREKzXwI=; b=BDG4MWPcFsU3d7XenytIQXuCVz
EwtgjeEw1bIFFGJctHYFJ73BW4cUUM3GYUCW/NdAxoY1inRYRlDV+IjlqncOZXFuhAya6O5dGdMG+
ZsaaHBetvcdhe4flUbB1QPsD8YICeYNcDJvGZeJz7vEXEBvMXhm6IFN5F9rIKGGbSza5bGu3Op/9W
jhDPQcUGymhETx9OjC6sjQuQjy7YUOhdDLIjTGKjUZTe06GckeaVtreu9bR7cDcrR1Bgy9e6cHdFi
aQmsREW+5XLs2S35hZaSzQITy+u6/OBgoC03KQEKj6NgKh2FTWfnysAVriKI6M4sq6HJPpUYc8ip0
XFkSPUZA==;
From: "=?utf-8?Q?Stephan_B=C3=B6ttcher?= (geda AT psjt DOT org) [via geda-user AT delorie DOT com]" <geda-user AT delorie DOT com>
To: geda-user AT delorie DOT com
Subject: [geda-user] pcb SaveMode
Date: Wed, 08 Jun 2022 11:42:43 +0200
Message-ID: <s6n7d5rqyng.fsf@blaulicht.dmz.brux>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id 2589gk40016628
Reply-To: geda-user AT delorie DOT com

Moin,

in PCB when I use the Rotate mode and use the middle mouse to move the
rotated object, for the first couple of times the Rotate mode will be
switched off.  After a while it sticks.  Since the edit sessions are
typically long, I could live with this.  Today I tried to get to the
bottom of it, got a fresh git pull (via http://, git:// failed) and
looked through the source, added a few fprintf()s and got:

SaveMode in case F_Stroke
SaveMode: position 1
SaveMode in click_cb
SaveMode: position 2
RestoreMode: position 1

SaveMode in case F_Stroke
SaveMode: position 2
SaveMode in click_cb
SaveMode: position 3
RestoreMode: position 2

Whenever I use the middle mouse button, there are two Save and one
Restore.  Eventually, the save stack is full, from that point it works
as intended.

It will obviously not harm to make the save stack smaller, or omit the
SaveMode() in F_Stroke, to work around the problem.  Any ideas how to fix
this properly?

Gruß,
Stephan

diff --git a/src/action.c b/src/action.c
index 9b7b9ca7..69628d31 100644
--- a/src/action.c
+++ b/src/action.c
@@ -617,12 +617,14 @@ click_cb (hidval hv)
 	  AddSelectedToBuffer (PASTEBUFFER, Note.X, Note.Y, true);
 	  SaveUndoSerialNumber ();
 	  RemoveSelected ();
+	  fprintf(stderr, "SaveMode in click_cb\n");
 	  SaveMode ();
 	  saved_mode = true;
 	  SetMode (PASTEBUFFER_MODE);
 	}
       else if (Note.Hit && !gui->shift_is_pressed ())
 	{
+	  fprintf(stderr, "SaveMode in click_cb\n");
 	  SaveMode ();
 	  saved_mode = true;
 	  SetMode (gui->control_is_pressed ()? COPY_MODE : MOVE_MODE);
@@ -3212,6 +3214,7 @@ ActionMode (int argc, char **argv, Coord x, Coord y)
 	    SetMode (POLYGON_MODE);
 	  else
 	    {
+	      fprintf(stderr, "SaveMode in case F_Stroke\n");
 	      SaveMode ();
 	      saved_mode = true;
 	      SetMode (ARROW_MODE);
@@ -3234,6 +3237,7 @@ ActionMode (int argc, char **argv, Coord x, Coord y)
 	  break;
 
 	case F_Save:		/* save currently selected mode */
+	  fprintf(stderr, "SaveMode in case F_Save\n");
 	  SaveMode ();
 	  break;
 	}
@@ -3859,6 +3863,7 @@ ActionDelete (int argc, char **argv, Coord x, Coord y)
   switch (id)
     {
     case F_Object:
+      fprintf(stderr, "SaveMode in case F_Object\n");
       SaveMode();
       SetMode(REMOVE_MODE);
       NotifyMode();
diff --git a/src/set.c b/src/set.c
index 19dd1a6a..243a8f68 100644
--- a/src/set.c
+++ b/src/set.c
@@ -212,6 +212,7 @@ SaveMode (void)
   mode_stack[mode_position] = Settings.Mode;
   if (mode_position < MAX_MODESTACK_DEPTH - 1)
     mode_position++;
+  fprintf(stderr, "SaveMode: position %d\n", mode_position);
 }
 
 /*!
@@ -226,6 +227,7 @@ RestoreMode (void)
       return;
     }
   SetMode (mode_stack[--mode_position]);
+  fprintf(stderr, "RestoreMode: position %d\n", mode_position);
 }
 
 


-- 
Stephan

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019