document.h

00001 /*  cssed (c) Iago Rubio 2003, 2005 - A tiny CSS editor.
00002  *
00003  *  This program is free software; you can redistribute it and/or modify
00004  *  it under the terms of the GNU General Public License as published by
00005  *  the Free Software Foundation; either version 2 of the License, or
00006  *  (at your option) any later version.
00007  *
00008  *  This program is distributed in the hope that it will be useful,
00009  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  *  GNU Library General Public License for more details.
00012  *
00013  *  You should have received a copy of the GNU General Public License
00014  *  along with this program; if not, write to the Free Software
00015  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00016  */
00017 
00018 #define SSM(s, m, w, l) scintilla_send_message(s, m, w, l)
00019 
00020 typedef struct _CssedCssDialogsData {
00021         CssedWindow* main_window;
00022         gchar* previous_string;
00023         gboolean add_property_string;
00024 } CssedCssDialogsData;
00025 
00026 typedef struct _CssedPopmenuData {
00027         CssedWindow* main_window;
00028         CssedDoc* document;
00029         gchar* attribute;
00030         gchar* property; // previous_string
00031         gboolean add_property_string;
00032 } CssedPopmenuData;
00033 
00034 typedef struct _CssedPoint {
00035         CssedWindow* main_window;
00036         gint x;
00037         gint y;
00038 } CssedPoint;
00039 /*
00040 GtkWidget *
00041 create_initial_blank_editor  (CssedWindow* window);
00042 */
00043 CssedDoc*
00044 create_and_attach_new_doc(CssedWindow* window ,const gchar* title);
00045 
00046 CssedDoc *
00047 cssed_create_new_doc (CssedWindow* window);
00048 
00049 gboolean
00050 document_save(CssedDoc* doc);
00051 
00052 gboolean
00053 document_save_as(CssedDoc* doc, gchar* filename);
00054 
00055 void
00056 document_close (CssedDoc* doc);
00057 
00058 void 
00059 document_add_text (CssedDoc* doc, gchar* text);
00060 
00061 // no need to be NULL terminated
00062 void
00063 document_add_text_buffer (CssedDoc* doc, gchar* buffer , gint len);
00064 
00065 void
00066 document_add_text_line (CssedDoc * doc, gchar* text);
00067 
00068 void 
00069 document_scroll_to_caret (CssedDoc* doc);
00070 
00071 CssedDoc*
00072 document_get_from_notebook_page_num(CssedWindow* window, gint page_number);
00073 
00074 CssedDoc*
00075 document_get_current(CssedWindow* window);
00076 
00077 gint
00078 document_get_index (CssedDoc* doc);
00079 
00080 void
00081 document_set_current(CssedDoc* doc);
00082 
00083 gboolean
00084 document_get_modified (CssedDoc* doc);
00085 
00086 gboolean
00087 document_dispose (CssedDoc* doc);
00088 
00089 gboolean 
00090 document_get_line_numbers_visible (CssedDoc* doc);
00091 
00092 void 
00093 document_set_line_numbers_visible (CssedDoc* doc, gboolean visible);
00094 
00095 gint
00096 document_get_position_from_line (CssedDoc* doc, gint line);
00097 
00098 void
00099 document_set_white_spaces_visible (CssedDoc* doc, gboolean visible);
00100 
00101 void
00102 document_set_line_endings_visible (CssedDoc* doc, gboolean visible);
00103 
00104 gboolean
00105 document_get_lines_wrapped (CssedDoc* doc);
00106 
00107 void
00108 document_set_lines_wrapped (CssedDoc* doc, gboolean wrapped);
00109 
00110 CssedEolMode
00111 document_get_eol_mode (CssedDoc* doc);
00112 
00113 void 
00114 document_set_eol_mode(CssedDoc* doc, CssedEolMode eolmode);
00115 
00116 void 
00117 document_convert_eols(CssedDoc* doc, CssedEolMode eolmode);
00118 
00119 gboolean
00120 document_get_line_endings_visible (CssedDoc* doc);
00121 
00122 gboolean
00123 document_get_lines_wrapped (CssedDoc* doc);
00124 
00125 gboolean
00126 document_get_white_spaces_visible (CssedDoc* doc);
00127 
00128 CssedDoc*
00129 document_get_from_editor (CssedWindow* window, GtkWidget* editor);
00130 
00131 gboolean 
00132 document_marker_next(CssedDoc* doc, gint line, gint marker_mask);
00133 
00134 gboolean 
00135 document_marker_prev(CssedDoc* doc, gint line, gint marker_mask);
00136 
00137 /* filetype */
00138 void
00139 document_set_filetype (CssedDoc* doc, CssedFileType* filetype);
00140 void
00141 document_set_filetype_by_id (CssedDoc* doc, CssedFileTypeId id);
00142 
00143 CssedFileType*
00144 document_get_filetype_from_filename (CssedDoc* doc, gchar* filename);
00145 
00146 CssedFileType*
00147 document_get_filetype (CssedDoc* doc);
00148 
00149 CssedFileTypeId
00150 document_get_filetype_id (CssedDoc* doc);
00151 /* */
00152 void
00153 document_set_font_by_name(CssedDoc* doc, gchar* font_name);
00154 
00155 void
00156 document_set_font(CssedDoc* doc);
00157 
00158 void
00159 document_set_codepage(CssedDoc* doc, CssedCodePage codepage);
00160 
00161 CssedCodePage
00162 document_get_codepage(CssedDoc* doc);
00163 
00164 void
00165 document_set_character_set(CssedDoc* doc, gint charset);
00166 
00167 void
00168 document_set_font_size(CssedDoc* doc, gint size);
00169 
00170 void
00171 document_set_current_font_size(CssedDoc* doc);
00172 
00173 void
00174 document_set_default_configuration (CssedDoc* doc);
00175 
00176 gboolean                        
00177 document_can_redo(CssedDoc* doc);
00178 
00179 gboolean                        
00180 document_can_undo(CssedDoc* doc);
00181 
00182 void 
00183 document_undo(CssedDoc* doc);
00184 
00185 void 
00186 document_redo(CssedDoc* doc);
00187 
00188 void 
00189 document_empty_undo_buffer(CssedDoc* doc);
00190 
00191 void 
00192 document_end_undo_action(CssedDoc* doc);
00193 
00194 void 
00195 document_new_undo_action(CssedDoc* doc);
00196 
00197 void 
00198 document_set_undo_collection(CssedDoc* doc, gboolean set);
00199 
00200 gboolean
00201 document_get_undo_collection(CssedDoc* doc);
00202 
00203 void 
00204 document_start_undo_action (CssedDoc* doc);
00205 
00206 void 
00207 document_search_next (CssedDoc* doc, gchar* text, gint flags);
00208 
00209 void
00210 document_search_prev (CssedDoc* doc, gchar* text, gint flags);
00211 
00212 void 
00213 document_zoom_in(CssedDoc* doc);
00214 
00215 void 
00216 document_zoom_off(CssedDoc* doc);
00217 
00218 void 
00219 document_zoom_out(CssedDoc* doc);
00220 
00221 void 
00222 document_set_marker_at_line (CssedDoc* doc, gint line, gboolean set, gint marker);
00223 
00224 gboolean
00225 document_is_marker_set_at_line (CssedDoc* doc, gint line, gint marker);
00226 
00227 gint
00228 document_get_line_from_position (CssedDoc* doc, gint position);
00229 
00230 gint 
00231 document_get_current_position (CssedDoc* doc);
00232 
00233 void
00234 document_set_current_position   (CssedDoc* doc, gint position);
00235 
00236 void
00237 document_set_current_line (CssedDoc* doc, gint line);
00238 
00239 void 
00240 document_paste (CssedDoc* doc);
00241 
00242 void 
00243 document_copy (CssedDoc* doc);
00244 
00245 void 
00246 document_cut (CssedDoc* doc);
00247 
00248 gint
00249 document_get_selection_end(CssedDoc* doc);
00250 
00251 gint
00252 document_get_selection_start(CssedDoc* doc);
00253 
00254 void
00255 document_set_selection_start(CssedDoc* doc, gint position);
00256 
00257 void
00258 document_set_selection_end(CssedDoc* doc, gint position);
00259 
00260 gint 
00261 document_get_line_end_from_position(CssedDoc* doc, gint position);
00262 
00263 void 
00264 document_set_selection_range(CssedDoc* doc,gint start, gint end);
00265 
00266 void
00267 document_replace_sel(CssedDoc* doc, gchar* text);
00268 
00269 void
00270 document_replace_sel_re(CssedDoc* doc, gchar* text);
00271 
00272 void
00273 document_clear_sel(CssedDoc* doc);
00274 
00275 gint
00276 document_get_length     (CssedDoc* doc);
00277 
00278 void
00279 document_get_text(CssedDoc* doc, gint len, gchar* text);
00280 
00281 void
00282 document_get_selected_text(CssedDoc* doc, gchar* text);
00283 void
00284 document_set_modified (CssedDoc* doc , gboolean modified);
00285 
00286 void
00287 document_set_save_point (CssedDoc* doc);
00288 
00289 void 
00290 document_write_error_to_program_output( CssedDoc* doc, 
00291                                                                                 gchar* error_message,
00292                                                                                 gchar* color);
00293                                                                                 
00294 void 
00295 document_show_user_list (CssedDoc* doc, gint identifier, gchar* list);
00296 
00297 void
00298 document_show_autocompletion_list (CssedDoc* doc, gint len, gchar* list);
00299 
00300 void 
00301 document_autocompletion_cancel (CssedDoc* doc);
00302 
00303 gboolean
00304 document_is_autocompletion_active (CssedDoc* doc);
00305 
00306 void 
00307 document_autocompletion_select (CssedDoc* doc, gchar* select);
00308 
00309 gboolean
00310 document_current_pos_is_into_selector(CssedDoc* doc);
00311         
00312 void
00313 document_get_text_line(CssedDoc* doc, gint line, gchar* buffer);
00314 
00315 gchar
00316 document_get_char_at(CssedDoc* doc, gint pos);
00317 
00318 gint 
00319 document_get_line_length(CssedDoc* doc, gint line);
00320 
00321 gint
00322 document_get_line_count (CssedDoc* doc);
00323 
00324 void 
00325 fire_dialog_from_strings_or_write_output(       CssedWindow* window,
00326                                                                                         CssedDoc* tmpdoc, 
00327                                                                                         gchar* attribute, 
00328                                                                                         gchar* property,
00329                                                                                         gboolean add_previous);
00330                                                                                         
00331 void
00332 document_toggle_fold_at_line(CssedDoc* doc, gint line);
00333 
00334 gboolean
00335 document_get_line_is_visible(CssedDoc* doc, gint line);
00336 
00337 void
00338 document_ensure_line_is_visible (CssedDoc* doc, gint line);
00339 
00340 gint
00341 document_get_fold_level (CssedDoc* doc, gint line);
00342 
00343 gint
00344 document_get_fold_depth(CssedDoc* doc, gint line);
00345 
00346 void 
00347 document_set_folding_margin_visible (CssedDoc* doc, gboolean visible);
00348 
00349 gboolean 
00350 document_get_folding_margin_visible (CssedDoc* doc);
00351 
00352 gboolean
00353 document_get_folding_enabled (CssedDoc* doc);
00354 
00355 void
00356 document_fold_all (CssedDoc* doc);
00357 
00358 void
00359 document_unfold_all (CssedDoc* doc);
00360 
00361 gboolean 
00362 document_get_fold_expanded_at_line (CssedDoc* doc, gint line);
00363 
00364 void                            
00365 document_style_clear_all(CssedDoc* doc) ;
00366 
00367 gint
00368 document_get_style_at(CssedDoc* doc, gint pos);
00369 
00370 void                            
00371 document_colourise_all(CssedDoc* doc);
00372 
00373 void                            
00374 document_colourise(CssedDoc* doc, gint start, gint end);
00375 
00376 void
00377 document_set_validator_arrow_at_line (CssedDoc* doc, gint line);
00378 
00379 void
00380 document_set_validator_arrow_at_line_on_idle (CssedDoc* doc, gint line);
00381 
00382 void
00383 document_clear_validator_arrow (CssedDoc* doc);
00384 
00385 // access to document object fields //
00386 CssedWindow*
00387 document_get_window (CssedDoc* doc);
00388 
00389 gchar* document_get_filename (CssedDoc* doc);
00390 
00391 void document_set_filename (CssedDoc* doc , gchar* filename);
00392 gboolean document_get_autocompletion_enabled (CssedDoc* doc);
00393 
00394 void
00395 document_set_autocompletion_enabled  (CssedDoc* doc, gboolean enabled);
00396 
00397 // for awfull auto-indentation, not clever but at leat as stupid as predictable.
00398 void
00399 document_indent_as_last_line (CssedDoc* doc);
00400 
00401 
00402 gboolean // returns true is the previous line starts in whitespace
00403 document_last_line_is_indented (CssedDoc* doc);
00404 
00405 // scintilla control access 
00406 GtkWidget* // you must use the SCINTILLA() macro to get the ScintillaObject and include scintilla headers 
00407 document_get_scintilla_widget (CssedDoc* doc);
00408 
00409 // new open function - returns NULL and sets error on failure */
00410 CssedDoc*
00411 document_open (CssedWindow* window , gchar *filename, GError **error);
00412 void
00413 document_open_with_error_check (CssedWindow* window , gchar *filename);
00414 gboolean
00415 document_add_file (CssedDoc* doc , gchar *filename, GError **err);
00416 // calltip
00417 void
00418 document_calltipshow (CssedDoc* doc, gint start, gchar* definition);
00419 void
00420 document_calltipcancel (CssedDoc* doc);
00421 gboolean
00422 document_calltipactive (CssedDoc* doc);
00423 gint
00424 document_calltiposstart (CssedDoc* doc);
00425 //
00426 void
00427 document_grab_focus     (CssedDoc* doc);
00429 void  
00430 document_pop_submenu_from_keyword_in_treeview(CssedDoc* doc,gchar* text);
00431 
00432 gpointer // to be wrapped by the plugin's interface
00433 document_send_scintilla_message ( CssedDoc* doc, guint iMessage, gulong wParam, glong lParam );

Back to Index

This documentation is © Iago Rubio Sanfiz, 2004