[cairo-commit] roadster/src Makefile.am, 1.10, 1.11 main.c, 1.13, 1.14 mainwindow.c, 1.19, 1.20 map_draw_cairo.c, 1.4, 1.5 prefs.c, NONE, 1.1 prefs.h, NONE, 1.1 searchwindow.c, 1.11, 1.12 track.c, 1.2, 1.3

Ian McIntosh commit at pdx.freedesktop.org
Mon Mar 7 15:31:43 PST 2005


Committed by: ian

Update of /cvs/cairo/roadster/src
In directory gabe:/tmp/cvs-serv13563/src

Modified Files:
	Makefile.am main.c mainwindow.c map_draw_cairo.c 
	searchwindow.c track.c 
Added Files:
	prefs.c prefs.h 
Log Message:
	* src/prefs.c:
	* src/prefs.h: Added. (Not currently used.)
	* src/main.c: Add init for prefs.
	* src/mainwindow.c: Squelch redraw user drags 0 distance.


Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/roadster/src/Makefile.am,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- Makefile.am	4 Mar 2005 02:27:29 -0000	1.10
+++ Makefile.am	7 Mar 2005 23:31:41 -0000	1.11
@@ -45,7 +45,8 @@
 	glyph.c\
 	map_draw_cairo.c\
 	map_draw_gdk.c\
-	road.c
+	road.c\
+	prefs.c
 
 roadster_LDADD = \
 	$(GNOME_LIBS) \

Index: main.c
===================================================================
RCS file: /cvs/cairo/roadster/src/main.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- main.c	4 Mar 2005 09:27:26 -0000	1.13
+++ main.c	7 Mar 2005 23:31:41 -0000	1.14
@@ -31,6 +31,7 @@
 #include "map.h"
 #include "gpsclient.h"
 #include "scenemanager.h"
+#include "prefs.h"
 
 static gboolean main_init(void);
 static void main_deinit(void);
@@ -47,6 +48,8 @@
 	if(!main_init())
 		return 1;
 
+	prefs_read();
+
 	gui_run();
 	main_deinit();
 
@@ -68,6 +71,9 @@
 	gnome_vfs_make_directory(pszApplicationDir, 0700);
 	g_free(pszApplicationDir);
 
+	g_print("initializing prefs\n");
+	prefs_init();	// note: doesn't READ prefs yet
+
 	g_print("initializing points\n");
 	point_init();
 	g_print("initializing pointstrings\n");

Index: mainwindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/mainwindow.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- mainwindow.c	7 Mar 2005 05:30:10 -0000	1.19
+++ mainwindow.c	7 Mar 2005 23:31:41 -0000	1.20
@@ -150,6 +150,7 @@
 	EDirection m_eScrollDirection;
 	
 	gboolean m_bMouseDragging;
+	gboolean m_bMouseDragMovement;
 	screenpoint_t m_ptClickLocation;
 
 	gint m_nCurrentGPSPath;
@@ -723,6 +724,7 @@
 //                                 gdk_cursor_unref(pCursor);
 
 				g_MainWindow.m_bMouseDragging = TRUE;
+				g_MainWindow.m_bMouseDragMovement = FALSE;
 				g_MainWindow.m_ptClickLocation.m_nX = nX;
 				g_MainWindow.m_ptClickLocation.m_nY = nY;
 //                                 }
@@ -739,10 +741,10 @@
 			// end mouse dragging, if active
 			if(g_MainWindow.m_bMouseDragging == TRUE) {
 				g_MainWindow.m_bMouseDragging = FALSE;
-//                                 gdk_pointer_ungrab(GDK_CURRENT_TIME);
-
-				mainwindow_cancel_draw_pretty_timeout();
-				mainwindow_draw_map(DRAWFLAG_ALL);
+				if(g_MainWindow.m_bMouseDragMovement) {
+					mainwindow_cancel_draw_pretty_timeout();
+					mainwindow_draw_map(DRAWFLAG_ALL);
+				}
 			}
 
 			// end scrolling, if active
@@ -755,6 +757,10 @@
 				mainwindow_draw_map(DRAWFLAG_ALL);
 			}
 		}
+		else if(event->type == GDK_2BUTTON_PRESS) {
+			map_center_on_windowpoint(g_MainWindow.m_pMap, nX, nY);
+			mainwindow_draw_map(DRAWFLAG_ALL);
+		}
 	}
 	// Right-click?
 //         else if (event->button == 3 && event->type == GDK_BUTTON_PRESS)
@@ -783,6 +789,8 @@
 	EDirection eScrollDirection = match_border(nX, nY, nWidth, nHeight, BORDER_SCROLL_CLICK_TARGET_SIZE);
 
 	if(g_MainWindow.m_bMouseDragging) {
+		g_MainWindow.m_bMouseDragMovement = TRUE;
+
 		// Set it here and no when first clicking because now we know it's a drag (on click it could be a double-click)
 		GdkCursor* pCursor = gdk_cursor_new(GDK_FLEUR);
 		gdk_window_set_cursor(GTK_WIDGET(g_MainWindow.m_pDrawingArea)->window, pCursor);
@@ -797,7 +805,7 @@
 			(nWidth / 2) + nDeltaX,
 			(nHeight / 2) + nDeltaY);
 		mainwindow_draw_map(DRAWFLAG_GEOMETRY);
-//		mainwindow_set_draw_pretty_timeout();
+		mainwindow_set_draw_pretty_timeout();
 
 		g_MainWindow.m_ptClickLocation.m_nX = nX;
 		g_MainWindow.m_ptClickLocation.m_nY = nY;

Index: map_draw_cairo.c
===================================================================
RCS file: /cvs/cairo/roadster/src/map_draw_cairo.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- map_draw_cairo.c	6 Mar 2005 23:38:19 -0000	1.4
+++ map_draw_cairo.c	7 Mar 2005 23:31:41 -0000	1.5
@@ -367,10 +367,8 @@
 //                         fDrawY -= (fPerpendicularNormalizedY * extents.height/2);
 			fDrawX -= (fPerpendicularNormalizedX * font_extents.ascent/2);
 			fDrawY -= (fPerpendicularNormalizedY * font_extents.ascent/2);
-
 		//~ }
 
-		//
 		cairo_save(pCairo);
 			cairo_move_to(pCairo, fDrawX, fDrawY);
 			cairo_set_rgb_color(pCairo, 0.0,0.0,0.0);

--- NEW FILE: prefs.c ---
/***************************************************************************
 *            prefs.c
 *
 *  Copyright  2005  Ian McIntosh
 *  ian_mcintosh at linuxadvocate.org
 ****************************************************************************/

/*
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

void prefs_init() {}
void pref_deinit() {}
void prefs_read() {}

/*
#include <glib.h>
#include <glib.h>

struct {
	GKeyFile* m_pKeyFile;
} g_Prefs = {0};


#define KEYFILE_GROUP_GUI_STATE  	("state")
#define KEYFILE_KEY_LATITUDE		("latitude")

void prefs_load()
{
	gchar* pszFilePath = ".roadster/prefs";

	// load existing keyfile
	g_Prefs.m_pKeyFile = g_key_file_new();
	if(!g_key_file_load_from_file(g_Prefs.m_pKeyFile, pszFilePath, G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS, NULL)) {
		
	}

        gchar* pszValue;

	//
	pszValue = g_key_file_get_value(g_Prefs.m_pKeyFile,
                                             KEYFILE_GROUP_GUI_STATE,
                                             KEYFILE_KEY_LATITUDE,
                                             NULL);
	g_print("value = %s\n", pszValue);
}

void prefs_save()
{

}
*/

--- NEW FILE: prefs.h ---
/***************************************************************************
 *            util.h
 *
 *  Copyright  2005  Ian McIntosh
 *  ian_mcintosh at linuxadvocate.org
 ****************************************************************************/

/*
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef _PREFS_H_
#define _PREFS_H_

void prefs_init();
void pref_deinit();
void prefs_load();
void prefs_save();

#endif // _PREFS_H_

Index: searchwindow.c
===================================================================
RCS file: /cvs/cairo/roadster/src/searchwindow.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- searchwindow.c	7 Mar 2005 05:30:10 -0000	1.11
+++ searchwindow.c	7 Mar 2005 23:31:41 -0000	1.12
@@ -151,8 +151,8 @@
 			RESULTLIST_ZOOMLEVEL, &nZoomLevel,
 			-1);
 
-		mainwindow_set_zoomlevel(nZoomLevel);
 		mainwindow_set_centerpoint(&pt);
+		mainwindow_set_zoomlevel(nZoomLevel);
 		mainwindow_draw_map(DRAWFLAG_ALL);
 		mainwindow_statusbar_update_position();
 	}

Index: track.c
===================================================================
RCS file: /cvs/cairo/roadster/src/track.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- track.c	4 Mar 2005 09:27:26 -0000	1.2
+++ track.c	7 Mar 2005 23:31:41 -0000	1.3
@@ -53,7 +53,7 @@
 	// insert into DB to get a unique ID
 	gint nID = 1;
 
-	// alloce structure for it
+	// allocate structure for it
 	track_t* pNew = g_mem_chunk_alloc0(g_Tracks.g_pTrackChunkAllocator);
 	pNew->m_nID = nID;
 	pointstring_alloc(&pNew->m_pPointString);




More information about the cairo-commit mailing list