SF.net SVN: geany: [643] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Thu Jul 27 23:17:47 UTC 2006


Revision: 643
Author:   eht16
Date:     2006-07-27 16:17:31 -0700 (Thu, 27 Jul 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=643&view=rev

Log Message:
-----------
Let the colour chooser pick the colour under the cursor(Win32 code). Added some sanity checks.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/callbacks.c
    trunk/src/dialogs.c
    trunk/src/win32.c
    trunk/src/win32.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-07-27 22:52:11 UTC (rev 642)
+++ trunk/ChangeLog	2006-07-27 23:17:31 UTC (rev 643)
@@ -9,6 +9,9 @@
    styles to keep the syntax highlighting consistent.
  * src/main.c: Removed startup warning.
  * src/geany.h, src/main.c: Added Select All item to sensitive buttons.
+ * src/win32.c, src/dialogs.c, src/callbacks.c: 
+   Let the colour chooser pick the colour under the cursor(Win32 code).
+   Added some sanity checks.
 
 
 2006-07-26  Enrico Tröger  <enrico.troeger at uvena.de>

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2006-07-27 22:52:11 UTC (rev 642)
+++ trunk/src/callbacks.c	2006-07-27 23:17:31 UTC (rev 643)
@@ -1454,6 +1454,9 @@
 	gint idx = document_get_cur_idx();
 	gint pos = sci_get_current_position(doc_list[idx].sci);
 
+	if (idx == -1 || ! doc_list[idx].is_valid)
+		return;
+
 	utils_find_current_word(doc_list[idx].sci, pos, colour, sizeof colour);
 	dialogs_show_color(colour);
 }

Modified: trunk/src/dialogs.c
===================================================================
--- trunk/src/dialogs.c	2006-07-27 22:52:11 UTC (rev 642)
+++ trunk/src/dialogs.c	2006-07-27 23:17:31 UTC (rev 643)
@@ -420,8 +420,7 @@
 void dialogs_show_color(gchar *colour)
 {
 #ifdef G_OS_WIN32
-	/// TODO pass colour to the windows dialog
-	win32_show_color_dialog();
+	win32_show_color_dialog(colour);
 #else
 
 	if (app->open_colorsel == NULL)

Modified: trunk/src/win32.c
===================================================================
--- trunk/src/win32.c	2006-07-27 22:52:11 UTC (rev 642)
+++ trunk/src/win32.c	2006-07-27 23:17:31 UTC (rev 643)
@@ -216,7 +216,7 @@
 }
 
 
-void win32_show_color_dialog(void)
+void win32_show_color_dialog(const gchar *colour)
 {
 	CHOOSECOLOR cc;
 	static COLORREF acr_cust_clr[16];
@@ -229,7 +229,7 @@
 	cc.lStructSize = sizeof(cc);
 	cc.hwndOwner = NULL;
 	cc.lpCustColors = (LPDWORD) acr_cust_clr;
-	cc.rgbResult = rgb_current;
+	cc.rgbResult = (colour != NULL) ? utils_strtod(colour, NULL, colour[0] == '#') : 0;
 	cc.Flags = CC_FULLOPEN | CC_RGBINIT;
 
 	if (ChooseColor(&cc))

Modified: trunk/src/win32.h
===================================================================
--- trunk/src/win32.h	2006-07-27 22:52:11 UTC (rev 642)
+++ trunk/src/win32.h	2006-07-27 23:17:31 UTC (rev 643)
@@ -30,7 +30,7 @@
 
 void win32_show_font_dialog(void);
 
-void win32_show_color_dialog(void);
+void win32_show_color_dialog(const gchar *colour);
 
 /* Creates a native Windows message box of the given type and returns always TRUE
  * or FALSE representing th pressed Yes or No button.


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Commits mailing list