SF.net SVN: geany: [781] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Sat Sep 2 20:49:17 UTC 2006


Revision: 781
          http://svn.sourceforge.net/geany/?rev=781&view=rev
Author:   ntrel
Date:     2006-09-02 13:49:11 -0700 (Sat, 02 Sep 2006)

Log Message:
-----------
Add document_get_current()

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/document.c
    trunk/src/document.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-09-02 20:30:35 UTC (rev 780)
+++ trunk/ChangeLog	2006-09-02 20:49:11 UTC (rev 781)
@@ -2,6 +2,7 @@
 
  * src/utils.c, src/sci_cb.c, src/main.c:
    Fixed C89 variable declaration and two sign comparison warnings.
+ * src/document.c, src/document.h: Add document_get_current().
 
 
 2006-09-01  Enrico Tröger  <enrico.troeger at uvena.de>

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2006-09-02 20:30:35 UTC (rev 780)
+++ trunk/src/document.c	2006-09-02 20:49:11 UTC (rev 781)
@@ -118,7 +118,7 @@
 
 
 /* returns the index of the current notebook page in the document list */
-gint document_get_cur_idx(void)
+gint document_get_cur_idx()
 {
 	gint cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(app->notebook));
 	ScintillaObject *sci = (ScintillaObject*)gtk_notebook_get_nth_page(GTK_NOTEBOOK(app->notebook), cur_page);
@@ -130,10 +130,19 @@
 }
 
 
+/* returns NULL if no documents are open */
+document *document_get_current()
+{
+	gint idx = document_get_cur_idx();
+
+	return DOC_IDX_VALID(idx) ? &doc_list[idx] : NULL;
+}
+
+
 /* returns the next free place(i.e. index) in the document list
  * If there is for any reason no free place, -1 is returned
  */
-gint document_get_new_idx(void)
+gint document_get_new_idx()
 {
 	guint i;
 
@@ -178,7 +187,7 @@
 
 /* sets in all document structs the flag is_valid to FALSE and initializes some members to NULL,
  * to mark it uninitialized. The flag is_valid is set to TRUE in document_create_new_sci(). */
-void document_init_doclist(void)
+void document_init_doclist()
 {
 	gint i;
 

Modified: trunk/src/document.h
===================================================================
--- trunk/src/document.h	2006-09-02 20:30:35 UTC (rev 780)
+++ trunk/src/document.h	2006-09-02 20:49:11 UTC (rev 781)
@@ -34,7 +34,8 @@
 #include "geany.h"
 #include "filetypes.h"
 
-#define VALID_DOC_IDX(idx) \
+
+#define DOC_IDX_VALID(idx) \
 	((idx) >= 0 && (idx) < GEANY_MAX_OPEN_FILES && doc_list[idx].is_valid)
 
 
@@ -79,16 +80,19 @@
 
 
 /* returns the index of the current notebook page in the document list */
-gint document_get_cur_idx(void);
+gint document_get_cur_idx();
 
+/* returns NULL if no documents are open */
+document *document_get_current();
 
+
 /* returns the index of the given notebook page in the document list */
 gint document_get_n_idx(guint);
 
 
 /* returns the next free place(i.e. index) in the document list
  * If there is for any reason no free place, -1 is returned */
-gint document_get_new_idx(void);
+gint document_get_new_idx();
 
 
 /* changes the color of the tab text according to the status */
@@ -100,7 +104,7 @@
 
 /* sets in all document structs the flag is_valid to FALSE and initializes some members to NULL,
  * to mark it uninitialized. The flag is_valid is set to TRUE in document_create_new_sci(). */
-void document_init_doclist(void);
+void document_init_doclist();
 
 
 // Apply just the prefs that can change in the Preferences dialog


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