19
19
* along with this program; if not, write to the Free Software
20
20
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
* $Id: navqueue.c 2505 2008-04-19 08:14:00Z eht16 $
22
* $Id: navqueue.c 2779 2008-07-15 14:29:41Z ntrel $
54
56
navigation_queue = g_queue_new();
57
navigation_buttons[0] = lookup_widget(app->window, "toolbutton_back");
58
navigation_buttons[1] = lookup_widget(app->window, "toolbutton_forward");
59
navigation_buttons[0] = lookup_widget(main_widgets.window, "toolbutton_back");
60
navigation_buttons[1] = lookup_widget(main_widgets.window, "toolbutton_forward");
136
138
* Add old file position and new file position to the navqueue, then goes to the new position.
138
* @param old_idx the %document index of the previous position, if set as invalid (-1) then no old
140
* @param old_doc The document of the previous position, if set as invalid (@c NULL) then no old
139
141
* position is set
140
* @param new_idx the %document index of the new position, must be valid.
142
* @param new_doc The document of the new position, must be valid.
141
143
* @param line the line number of the new position. It is counted with 1 as the first line, not 0.
143
145
* @return @a TRUE if the cursor has changed the position to @a line or @a FALSE otherwise.
145
gboolean navqueue_goto_line(gint old_idx, gint new_idx, gint line)
147
gboolean navqueue_goto_line(GeanyDocument *old_doc, GeanyDocument *new_doc, gint line)
149
g_return_val_if_fail(DOC_IDX_VALID(new_idx), FALSE);
151
g_return_val_if_fail(new_doc != NULL, FALSE);
150
152
g_return_val_if_fail(line >= 1, FALSE);
152
pos = sci_get_position_from_line(doc_list[new_idx].sci, line - 1);
154
pos = sci_get_position_from_line(new_doc->editor->sci, line - 1);
154
156
/* first add old file position */
155
if (DOC_IDX_VALID(old_idx) && doc_list[old_idx].file_name)
157
if (old_doc != NULL && old_doc->file_name)
157
gint cur_pos = sci_get_current_position(doc_list[old_idx].sci);
159
gint cur_pos = sci_get_current_position(old_doc->editor->sci);
159
add_new_position(doc_list[old_idx].file_name, cur_pos);
161
add_new_position(old_doc->file_name, cur_pos);
162
164
/* now add new file position */
163
if (doc_list[new_idx].file_name)
165
if (new_doc->file_name)
165
add_new_position(doc_list[new_idx].file_name, pos);
167
add_new_position(new_doc->file_name, pos);
168
return utils_goto_pos(new_idx, pos);
170
return editor_goto_pos(new_doc->editor, pos, TRUE);
174
static gboolean goto_file_pos(const gchar *file, gint pos)
176
GeanyDocument *doc = document_find_by_filename(file);
181
return editor_goto_pos(doc->editor, pos, TRUE);