Revision: 1295
http://svn.sourceforge.net/geany/?rev=1295&view=rev
Author: eht16
Date: 2007-02-16 08:59:24 -0800 (Fri, 16 Feb 2007)
Log Message:
-----------
Update the symbol list when starting a new document.
Modified Paths:
--------------
branches/geany-0.10.1/NEWS
branches/geany-0.10.1/src/document.c
Modified: branches/geany-0.10.1/NEWS
===================================================================
--- branches/geany-0.10.1/NEWS 2007-02-16 16:53:45 UTC (rev 1294)
+++ branches/geany-0.10.1/NEWS 2007-02-16 16:59:24 UTC (rev 1295)
@@ -34,6 +34,7 @@
* Added several missing style types for filetype Perl (thanks to
John Gabriele for reporting).
* Prevent right click in Symbol list from selecting a tag.
+ * Update the symbol list when starting a new document.
Internationalisation:
* New translations: fi (thanks to Harri Koskinen).
Modified: branches/geany-0.10.1/src/document.c
===================================================================
--- branches/geany-0.10.1/src/document.c 2007-02-16 16:53:45 UTC (rev 1294)
+++ branches/geany-0.10.1/src/document.c 2007-02-16 16:59:24 UTC (rev 1295)
@@ -408,8 +408,11 @@
if (ft == NULL) filetypes[GEANY_FILETYPES_ALL]->style_func_ptr(doc_list[idx].sci);
ui_set_window_title(idx);
build_menu_update(idx);
+
doc_list[idx].mtime = time(NULL);
doc_list[idx].changed = FALSE;
+
+ document_update_tag_list(idx, FALSE);
document_set_text_changed(idx);
ui_document_show_hide(idx); //update the document menu
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 1294
http://svn.sourceforge.net/geany/?rev=1294&view=rev
Author: ntrel
Date: 2007-02-16 08:53:45 -0800 (Fri, 16 Feb 2007)
Log Message:
-----------
Set single undo action when stripping trailing spaces.
Modified Paths:
--------------
branches/geany-0.10.1/NEWS
branches/geany-0.10.1/src/document.c
Modified: branches/geany-0.10.1/NEWS
===================================================================
--- branches/geany-0.10.1/NEWS 2007-02-16 16:44:16 UTC (rev 1293)
+++ branches/geany-0.10.1/NEWS 2007-02-16 16:53:45 UTC (rev 1294)
@@ -7,7 +7,8 @@
loaded first.
* Fixed autocompletion missing tag matches.
* Fixed a wrong PASCAL autocompletion.
- * Set single undo action when toggling multiple lines.
+ * Set single undo action when toggling multiple lines or stripping
+ trailing spaces.
* Prevent some possible invalid memory reads.
* Convert config, application and documentation dir paths to locale
encoding before using it.
Modified: branches/geany-0.10.1/src/document.c
===================================================================
--- branches/geany-0.10.1/src/document.c 2007-02-16 16:44:16 UTC (rev 1293)
+++ branches/geany-0.10.1/src/document.c 2007-02-16 16:53:45 UTC (rev 1294)
@@ -1603,6 +1603,8 @@
gint max_lines = sci_get_line_count(doc_list[idx].sci);
gint line;
+ sci_start_undo_action(doc_list[idx].sci);
+
for (line = 0; line < max_lines; line++)
{
gint line_start = sci_get_position_from_line(doc_list[idx].sci, line);
@@ -1622,6 +1624,7 @@
sci_target_replace(doc_list[idx].sci, "", FALSE);
}
}
+ sci_end_undo_action(doc_list[idx].sci);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 1291
http://svn.sourceforge.net/geany/?rev=1291&view=rev
Author: eht16
Date: 2007-02-16 08:34:57 -0800 (Fri, 16 Feb 2007)
Log Message:
-----------
Prevent right click in Symbol list from selecting a tag.
Modified Paths:
--------------
branches/geany-0.10.1/NEWS
branches/geany-0.10.1/src/treeviews.c
Modified: branches/geany-0.10.1/NEWS
===================================================================
--- branches/geany-0.10.1/NEWS 2007-02-15 23:56:15 UTC (rev 1290)
+++ branches/geany-0.10.1/NEWS 2007-02-16 16:34:57 UTC (rev 1291)
@@ -32,6 +32,7 @@
* Fixed wrong D function return type after a class definition.
* Added several missing style types for filetype Perl (thanks to
John Gabriele for reporting).
+ * Prevent right click in Symbol list from selecting a tag.
Internationalisation:
* New translations: fi (thanks to Harri Koskinen).
Modified: branches/geany-0.10.1/src/treeviews.c
===================================================================
--- branches/geany-0.10.1/src/treeviews.c 2007-02-15 23:56:15 UTC (rev 1290)
+++ branches/geany-0.10.1/src/treeviews.c 2007-02-16 16:34:57 UTC (rev 1291)
@@ -599,8 +599,11 @@
gtk_menu_popup(GTK_MENU(tv.popup_openfiles), NULL, NULL, NULL, NULL,
event->button, event->time);
else if (GPOINTER_TO_INT(user_data) == TREEVIEW_SYMBOL)
+ {
gtk_menu_popup(GTK_MENU(tv.popup_taglist), NULL, NULL, NULL, NULL,
event->button, event->time);
+ return TRUE; // prevent selection changed signal for symbol tags
+ }
}
return FALSE;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 1290
http://svn.sourceforge.net/geany/?rev=1290&view=rev
Author: eht16
Date: 2007-02-15 15:56:15 -0800 (Thu, 15 Feb 2007)
Log Message:
-----------
Added possibility to create and open non-existent files from command line (closes #1635094 and #1652917).
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/callbacks.c
trunk/src/document.c
trunk/src/document.h
trunk/src/keybindings.c
trunk/src/main.c
trunk/src/socket.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-02-15 23:20:41 UTC (rev 1289)
+++ trunk/ChangeLog 2007-02-15 23:56:15 UTC (rev 1290)
@@ -4,6 +4,10 @@
Added several missing style types for filetype Perl
(thanks to John Gabriele for reporting).
* src/treeviews.c: Aligned "No symbols found" label to top.
+ * src/callbacks.c, src/document.c, src/document.h, src/keybindings.c,
+ src/main.c, src/socket.c:
+ Added possibility to create and open non-existent files from command
+ line (closes #1635094 and #1652917).
2007-02-14 Frank Lanitz <frank(a)frank.uvena.de>
Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c 2007-02-15 23:20:41 UTC (rev 1289)
+++ trunk/src/callbacks.c 2007-02-15 23:56:15 UTC (rev 1290)
@@ -191,7 +191,7 @@
on_new1_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- document_new_file(NULL);
+ document_new_file(NULL, NULL);
}
@@ -199,7 +199,7 @@
on_new_with_template (GtkMenuItem *menuitem,
gpointer user_data)
{
- document_new_file((filetype*) user_data);
+ document_new_file(NULL, (filetype*) user_data);
}
@@ -546,7 +546,7 @@
on_toolbutton8_clicked (GtkToolButton *toolbutton,
gpointer user_data)
{
- document_new_file(NULL);
+ document_new_file(NULL, NULL);
}
// open file
@@ -1362,7 +1362,7 @@
on_toolbutton_new_clicked (GtkToolButton *toolbutton,
gpointer user_data)
{
- document_new_file(NULL);
+ document_new_file(NULL, NULL);
}
Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c 2007-02-15 23:20:41 UTC (rev 1289)
+++ trunk/src/document.c 2007-02-15 23:56:15 UTC (rev 1290)
@@ -389,10 +389,12 @@
/* This creates a new document, by clearing the text widget and setting the
- current filename to NULL. */
-void document_new_file(filetype *ft)
+ current filename to filename or NULL. If ft is NULL and filename is not NULL, then the filetype
+ will be guessed from the given filename.
+ filename is expected in UTF-8 encoding. */
+gint document_new_file(const gchar *filename, filetype *ft)
{
- gint idx = document_create_new_sci(NULL);
+ gint idx = document_create_new_sci(filename);
gchar *template = templates_get_template_new_file(ft);
g_assert(idx != -1);
@@ -415,6 +417,9 @@
store_saved_encoding(idx);
//document_set_filetype(idx, (ft == NULL) ? filetypes[GEANY_FILETYPES_ALL] : ft);
+ if (ft == NULL && filename != NULL) // guess the filetype from the filename if one is given
+ ft = filetypes_get_from_filename(idx);
+
document_set_filetype(idx, ft); // also clears taglist
if (ft == NULL) filetypes[GEANY_FILETYPES_ALL]->style_func_ptr(doc_list[idx].sci);
ui_set_window_title(idx);
@@ -425,7 +430,7 @@
document_update_tag_list(idx, FALSE);
document_set_text_changed(idx);
- ui_document_show_hide(idx); //update the document menu
+ ui_document_show_hide(idx); // update the document menu
sci_set_line_numbers(doc_list[idx].sci, app->show_linenumber_margin, 0);
sci_goto_pos(doc_list[idx].sci, 0, TRUE);
@@ -434,7 +439,10 @@
g_signal_connect((GtkWidget*) doc_list[idx].sci, "sci-notify",
G_CALLBACK(on_editor_notification), GINT_TO_POINTER(idx));
- msgwin_status_add(_("New file opened."));
+ msgwin_status_add(_("New file \"%s\" opened."),
+ (doc_list[idx].file_name != NULL) ? doc_list[idx].file_name : GEANY_STRING_UNTITLED);
+
+ return idx;
}
Modified: trunk/src/document.h
===================================================================
--- trunk/src/document.h 2007-02-15 23:20:41 UTC (rev 1289)
+++ trunk/src/document.h 2007-02-15 23:56:15 UTC (rev 1290)
@@ -123,8 +123,10 @@
/* This creates a new document, by clearing the text widget and setting the
- current filename to NULL. */
-void document_new_file(filetype *ft);
+ current filename to filename or NULL. If ft is NULL and filename is not NULL, then the filetype
+ will be guessed from the given filename.
+ filename is expected in UTF-8 encoding. */
+gint document_new_file(const gchar *filename, filetype *ft);
/* If idx is set to -1, it creates a new tab, opens the file from filename and
@@ -133,7 +135,7 @@
* idx and set the cursor to position 0. In this case, filename should be NULL
* It returns the idx of the opened file or -1 if an error occurred.
*/
-int document_open_file(gint, const gchar*, gint, gboolean, filetype*, const gchar*);
+gint document_open_file(gint, const gchar*, gint, gboolean, filetype*, const gchar*);
/* Takes a new line separated list of filename URIs and opens each file.
@@ -141,7 +143,7 @@
void document_open_file_list(const gchar *data, gssize length);
-int document_reload_file(gint idx, const gchar *forced_enc);
+gint document_reload_file(gint idx, const gchar *forced_enc);
/* This saves the file.
Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c 2007-02-15 23:20:41 UTC (rev 1289)
+++ trunk/src/keybindings.c 2007-02-15 23:56:15 UTC (rev 1290)
@@ -469,7 +469,7 @@
/* these are the callback functions, each shortcut has its own function, this is only for clear code */
static void cb_func_menu_new(G_GNUC_UNUSED guint key_id)
{
- document_new_file(NULL);
+ document_new_file(NULL, NULL);
}
static void cb_func_menu_open(G_GNUC_UNUSED guint key_id)
Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c 2007-02-15 23:20:41 UTC (rev 1289)
+++ trunk/src/main.c 2007-02-15 23:56:15 UTC (rev 1290)
@@ -484,7 +484,7 @@
// open files from command line
-gboolean open_cl_files(gint argc, gchar **argv)
+static gboolean open_cl_files(gint argc, gchar **argv)
{
gint i;
@@ -494,7 +494,7 @@
{
gchar *filename = get_argv_filename(argv[i]);
- if (filename &&
+ if (filename != NULL &&
g_file_test(filename, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK))
{
gint idx;
@@ -504,6 +504,14 @@
if (DOC_IDX_VALID(idx))
ui_add_recent_file(doc_list[idx].file_name);
}
+ else if (filename != NULL)
+ { // create new file if it doesn't exist
+ gint idx;
+
+ idx = document_new_file(filename, NULL);
+ if (DOC_IDX_VALID(idx))
+ ui_add_recent_file(doc_list[idx].file_name);
+ }
else
{
gchar *msg = _("Could not find file '%s'.");
@@ -648,7 +656,7 @@
app->opening_session_files = FALSE;
// open a new file if no other file was opened
- if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) == 0) document_new_file(NULL);
+ if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(app->notebook)) == 0) document_new_file(NULL, NULL);
ui_close_buttons_toggle();
ui_save_buttons_toggle(FALSE);
Modified: trunk/src/socket.c
===================================================================
--- trunk/src/socket.c 2007-02-15 23:20:41 UTC (rev 1289)
+++ trunk/src/socket.c 2007-02-15 23:56:15 UTC (rev 1290)
@@ -60,6 +60,7 @@
#include "socket.h"
#include "document.h"
#include "support.h"
+#include "ui_utils.h"
@@ -125,8 +126,8 @@
{
filename = get_argv_filename(argv[i]);
- if (filename != NULL &&
- g_file_test(filename, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK))
+ // if the filename is valid or if a new file should be opened is check on the other side
+ if (filename != NULL)
{
socket_fd_write_all(sock, filename, strlen(filename));
socket_fd_write_all(sock, "\n", 1);
@@ -409,7 +410,15 @@
if (g_file_test(buf, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK))
document_open_file(-1, buf, 0, FALSE, NULL, NULL);
else
- geany_debug("got data from socket, but it does not look like a filename");
+ { // create new file if it doesn't exist
+ gint idx;
+
+ idx = document_new_file(buf, NULL);
+ if (DOC_IDX_VALID(idx))
+ ui_add_recent_file(doc_list[idx].file_name);
+ else
+ geany_debug("got data from socket, but it does not look like a filename");
+ }
}
gtk_window_deiconify(GTK_WINDOW(app->window));
#ifdef G_OS_WIN32
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.