作図ソフト dia の改良版
Révision | 70e10d078e87206c89c3a1ea31dc1b05b04193fa (tree) |
---|---|
l'heure | 2014-10-04 18:43:26 |
Auteur | Hans Breuer <hans@breu...> |
Commiter | Hans Breuer |
[warningectomy] remove unused variables and functions
the special text editing 'accumulating' was unfinished for too long.
Now it's gone with it's warnings.
textedit.c:148:19: warning: unused variable 'change' [-Wunused-variable]
textedit.c:370:1: warning: unused function 'text_edit_create_change' [-Wunused-function]
text_edit_create_change(Text *text)
textedit.c:394:1: warning: unused function 'text_edit_update' [-Wunused-function]
text_edit_update(TextEditChange *change)
@@ -54,9 +54,6 @@ typedef struct TextEditChange { | ||
54 | 54 | Text *text; |
55 | 55 | } TextEditChange; |
56 | 56 | |
57 | -static Change *text_edit_create_change(Text *text); | |
58 | -static void text_edit_update(TextEditChange *change); | |
59 | -static void text_edit_apply(Change *change, Diagram *dia); | |
60 | 57 | static void textedit_end_edit(DDisplay *ddisp, Focus *focus); |
61 | 58 | |
62 | 59 | /** Returns TRUE if the given display is currently in text-edit mode. */ |
@@ -131,9 +128,6 @@ textedit_begin_edit(DDisplay *ddisp, Focus *focus) | ||
131 | 128 | ddisplay_set_active_focus(ddisp, focus); |
132 | 129 | highlight_object(focus->obj, DIA_HIGHLIGHT_TEXT_EDIT, ddisp->diagram); |
133 | 130 | object_add_updates(focus->obj, ddisp->diagram); |
134 | -/* Undo not quite ready yet. | |
135 | - undo_push_change(ddisp->diagram->undo, text_edit_create_change(focus->text)); | |
136 | -*/ | |
137 | 131 | } |
138 | 132 | |
139 | 133 | /** Stop editing a particular text focus. This must only be called in |
@@ -145,7 +139,6 @@ textedit_begin_edit(DDisplay *ddisp, Focus *focus) | ||
145 | 139 | static void |
146 | 140 | textedit_end_edit(DDisplay *ddisp, Focus *focus) |
147 | 141 | { |
148 | - TextEditChange *change; | |
149 | 142 | /* During destruction of the diagram the display may already be gone */ |
150 | 143 | if (!ddisp) |
151 | 144 | return; |
@@ -158,13 +151,6 @@ textedit_end_edit(DDisplay *ddisp, Focus *focus) | ||
158 | 151 | highlight_object_off(focus->obj, ddisp->diagram); |
159 | 152 | object_add_updates(focus->obj, ddisp->diagram); |
160 | 153 | diagram_object_modified(ddisp->diagram, focus->obj); |
161 | -/* Undo not quite ready yet | |
162 | - change = (TextEditChange *) undo_remove_to(ddisp->diagram->undo, | |
163 | - text_edit_apply); | |
164 | - if (change != NULL) { | |
165 | - text_edit_update(change); | |
166 | - } | |
167 | -*/ | |
168 | 154 | ddisplay_set_active_focus(ddisp, NULL); |
169 | 155 | } |
170 | 156 |
@@ -337,62 +323,3 @@ textedit_remove_focus_all(Diagram *diagram) | ||
337 | 323 | * changes are not allowed in text edit mode: It would break the undo. |
338 | 324 | */ |
339 | 325 | |
340 | -static void | |
341 | -text_edit_apply(Change *change, Diagram *dia) | |
342 | -{ | |
343 | - TextEditChange *te_change = (TextEditChange *) change; | |
344 | - text_set_string(te_change->text, te_change->new_text); | |
345 | -} | |
346 | - | |
347 | -static void | |
348 | -text_edit_revert(TextEditChange *change, Diagram *dia) | |
349 | -{ | |
350 | - if (textedit_mode(ddisplay_active())) { | |
351 | - DDisplay *ddisp = ddisplay_active(); | |
352 | - textedit_exit(ddisp); | |
353 | - } | |
354 | - text_set_string(change->text, change->orig_text); | |
355 | -} | |
356 | - | |
357 | -static void | |
358 | -text_edit_free(TextEditChange *change) | |
359 | -{ | |
360 | - g_free(change->orig_text); | |
361 | - if (change->new_text) { | |
362 | - g_free(change->new_text); | |
363 | - } | |
364 | -} | |
365 | - | |
366 | -/** Note that the new text isn't known when this is made. That gets | |
367 | - * added later. | |
368 | - */ | |
369 | -static Change * | |
370 | -text_edit_create_change(Text *text) | |
371 | -{ | |
372 | - TextEditChange *change; | |
373 | - | |
374 | - change = g_new0(TextEditChange, 1); | |
375 | - | |
376 | - change->obj_change.apply = (UndoApplyFunc) text_edit_apply; | |
377 | - change->obj_change.revert = (UndoRevertFunc) text_edit_revert; | |
378 | - change->obj_change.free = (UndoFreeFunc) text_edit_free; | |
379 | - | |
380 | - change->text = text; | |
381 | - if (text_is_empty(text)) { | |
382 | - change->orig_text = g_strdup(""); | |
383 | - } else { | |
384 | - change->orig_text = text_get_string_copy(text); | |
385 | - } | |
386 | - /* new_text not ready yet */ | |
387 | - | |
388 | - return (Change *)change; | |
389 | -} | |
390 | - | |
391 | -/** This should be called when an edit is finished, to store the final | |
392 | - * text. */ | |
393 | -static void | |
394 | -text_edit_update(TextEditChange *change) | |
395 | -{ | |
396 | - change->new_text = text_get_string_copy(change->text); | |
397 | -} | |
398 | - |